Skip to content

MCP server returns -32601 for resources/templates/list #2826

@obchain

Description

@obchain

Summary

The MCP stdio + HTTP server advertises the resources capability but does not implement resources/templates/list. Compliant MCP clients (Claude Desktop, Cursor, Zed) probe resources/templates/list after seeing the resources capability in initialize and today get -32601 Method not found instead of an empty resourceTemplates array.

Problem

The current initialize capability block on main is:

{
  "capabilities": {
    "tools": {},
    "resources": { "subscribe": false, "listChanged": false }
  }
}

With resources advertised, the spec invites clients to call all three resource discovery methods (resources/list, resources/read, resources/templates/list). Calling the third returns:

{ "error": { "code": -32601, "message": "Method not found", "data": "unsupported MCP method `resources/templates/list`" } }

Clients log this as a spec violation (cosmetic - graceful fallback) but it pollutes their debug surface and signals an incomplete server. The catalog is fully static, so the correct response is an empty resourceTemplates array; the handler is a one-line stub.

Solution (optional)

Add resources/templates/list to handle_request in src/openhuman/mcp_server/protocol.rs returning { "resourceTemplates": [] } from a new resources::list_resource_templates_result() helper. No capability change (still under the existing resources block). No URI scheme change.

Acceptance criteria

  • resources/templates/list returns {resourceTemplates: []} - wired through handle_json_value end-to-end, not just the helper.
  • Unknown / cursor params tolerated - extra params do not force a -32602 Invalid params.
  • Unit + wire-through tests - at least one pure helper test plus two handle_json_value tests (bare + with cursor).
  • Docs updated - gitbooks/developing/mcp-server.md (+ zh-CN) get a Resource Templates note and the smoke-test snippet exercises the new method; docs/TEST-COVERAGE-MATRIX.md adds a row under 11.1.
  • Diff coverage >= 80% - the implementing PR meets the changed-lines coverage gate.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions