this repo has no description
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix resources/templates/list handling

- Add handle_resource_templates_list function for the resources/templates/list method
- Add resourceTemplates capability to the server
- Update server capabilities with resourceTemplates option

This fixes the 'Method not found: resources/templates/list' error when running the MCP server.

+20
+12
lib/mcp_sdk.ml
··· 442 442 else 443 443 caps 444 444 in 445 + let caps = 446 + if with_resource_templates then 447 + ("resourceTemplates", `Assoc [ 448 + ("listChanged", `Bool true) 449 + ]) :: caps 450 + else if not with_resource_templates then 451 + ("resourceTemplates", `Assoc [ 452 + ("listChanged", `Bool false) 453 + ]) :: caps 454 + else 455 + caps 456 + in 445 457 let caps = 446 458 if with_prompts then 447 459 ("prompts", `Assoc [
+8
lib/mcp_server.ml
··· 60 60 let response = Mcp_rpc.ResourcesList.create_response ~id:req.id ~resources:resources_list () in 61 61 Some response 62 62 63 + (* Process resources/templates/list request *) 64 + let handle_resource_templates_list server (req:JSONRPCMessage.request) = 65 + Log.debug "Processing resources/templates/list request"; 66 + let templates_list = ResourceTemplate.to_rpc_resource_templates_list (resource_templates server) in 67 + let response = Mcp_rpc.ListResourceTemplatesResult.create_response ~id:req.id ~resource_templates:templates_list () in 68 + Some response 69 + 63 70 (* Utility module for resource template matching *) 64 71 module Resource_matcher = struct 65 72 (* Define variants for resource handling result *) ··· 323 330 | Method.PromptsList -> handle_prompts_list server req 324 331 | Method.ResourcesList -> handle_resources_list server req 325 332 | Method.ResourcesRead -> handle_resources_read server req 333 + | Method.ResourceTemplatesList -> handle_resource_templates_list server req 326 334 | _ -> 327 335 Log.errorf "Unknown method received: %s" (Method.to_string req.meth); 328 336 Some (create_jsonrpc_error req.id ErrorCode.MethodNotFound ("Method not found: " ^ (Method.to_string req.meth)) ()))