@@ -74,11 +74,13 @@ func NewMCPServer() *server.MCPServer {
7474 mcpServer .AddResource (mcp .NewResource ("test://static/resource" ,
7575 "Static Resource" ,
7676 mcp .WithMIMEType ("text/plain" ),
77+ mcp .WithResourceTitle ("Static Text Resource" ),
7778 ), handleReadResource )
7879 mcpServer .AddResourceTemplate (
7980 mcp .NewResourceTemplate (
8081 "test://dynamic/resource/{id}" ,
8182 "Dynamic Resource" ,
83+ mcp .WithTemplateTitle ("Dynamic Resource Template" ),
8284 ),
8385 handleResourceTemplate ,
8486 )
@@ -90,9 +92,11 @@ func NewMCPServer() *server.MCPServer {
9092
9193 mcpServer .AddPrompt (mcp .NewPrompt (string (SIMPLE ),
9294 mcp .WithPromptDescription ("A simple prompt" ),
95+ mcp .WithPromptTitle ("Simple Prompt Example" ),
9396 ), handleSimplePrompt )
9497 mcpServer .AddPrompt (mcp .NewPrompt (string (COMPLEX ),
9598 mcp .WithPromptDescription ("A complex prompt" ),
99+ mcp .WithPromptTitle ("Complex Prompt with Arguments" ),
96100 mcp .WithArgument ("temperature" ,
97101 mcp .ArgumentDescription ("The temperature parameter for generation" ),
98102 mcp .RequiredArgument (),
@@ -104,19 +108,23 @@ func NewMCPServer() *server.MCPServer {
104108 ), handleComplexPrompt )
105109 mcpServer .AddTool (mcp .NewTool (string (ECHO ),
106110 mcp .WithDescription ("Echoes back the input" ),
111+ mcp .WithTitle ("Echo Tool" ),
107112 mcp .WithString ("message" ,
108113 mcp .Description ("Message to echo" ),
109114 mcp .Required (),
110115 ),
111116 ), handleEchoTool )
112117
113118 mcpServer .AddTool (
114- mcp .NewTool ("notify" ),
119+ mcp .NewTool ("notify" ,
120+ mcp .WithTitle ("Send Notification" ),
121+ ),
115122 handleSendNotification ,
116123 )
117124
118125 mcpServer .AddTool (mcp .NewTool (string (ADD ),
119126 mcp .WithDescription ("Adds two numbers" ),
127+ mcp .WithTitle ("Number Addition Tool" ),
120128 mcp .WithNumber ("a" ,
121129 mcp .Description ("First number" ),
122130 mcp .Required (),
@@ -131,6 +139,7 @@ func NewMCPServer() *server.MCPServer {
131139 mcp .WithDescription (
132140 "Demonstrates a long running operation with progress updates" ,
133141 ),
142+ mcp .WithTitle ("Long Running Operation Demo" ),
134143 mcp .WithNumber ("duration" ,
135144 mcp .Description ("Duration of the operation in seconds" ),
136145 mcp .DefaultNumber (10 ),
@@ -161,6 +170,7 @@ func NewMCPServer() *server.MCPServer {
161170 // }, s.handleSampleLLMTool)
162171 mcpServer .AddTool (mcp .NewTool (string (GET_TINY_IMAGE ),
163172 mcp .WithDescription ("Returns the MCP_TINY_IMAGE" ),
173+ mcp .WithTitle ("Tiny Image Provider" ),
164174 ), handleGetTinyImageTool )
165175
166176 mcpServer .AddNotificationHandler ("notification" , handleNotification )
@@ -172,18 +182,23 @@ func generateResources() []mcp.Resource {
172182 resources := make ([]mcp.Resource , 100 )
173183 for i := 0 ; i < 100 ; i ++ {
174184 uri := fmt .Sprintf ("test://static/resource/%d" , i + 1 )
185+ resourceName := fmt .Sprintf ("Resource %d" , i + 1 )
186+ resourceTitle := fmt .Sprintf ("Generated Resource #%d" , i + 1 )
187+
175188 if i % 2 == 0 {
176- resources [i ] = mcp.Resource {
177- URI : uri ,
178- Name : fmt .Sprintf ("Resource %d" , i + 1 ),
179- MIMEType : "text/plain" ,
180- }
189+ resources [i ] = mcp .NewResource (
190+ uri ,
191+ resourceName ,
192+ mcp .WithMIMEType ("text/plain" ),
193+ mcp .WithResourceTitle (resourceTitle ),
194+ )
181195 } else {
182- resources [i ] = mcp.Resource {
183- URI : uri ,
184- Name : fmt .Sprintf ("Resource %d" , i + 1 ),
185- MIMEType : "application/octet-stream" ,
186- }
196+ resources [i ] = mcp .NewResource (
197+ uri ,
198+ resourceName ,
199+ mcp .WithMIMEType ("application/octet-stream" ),
200+ mcp .WithResourceTitle (resourceTitle ),
201+ )
187202 }
188203 }
189204 return resources
0 commit comments