Skip to content

feat(mcp): add resources/templates/list handler#2833

Closed
staimoorulhassan wants to merge 2 commits into
tinyhumansai:mainfrom
staimoorulhassan:fix/mcp-resource-templates-list
Closed

feat(mcp): add resources/templates/list handler#2833
staimoorulhassan wants to merge 2 commits into
tinyhumansai:mainfrom
staimoorulhassan:fix/mcp-resource-templates-list

Conversation

@staimoorulhassan
Copy link
Copy Markdown
Contributor

Implements #2826: missing MCP resources/templates/list endpoint.

Changes:

  • Add list_resource_templates_result() helper in resources.rs returning empty resourceTemplates array
  • Wire resources/templates/list handler in protocol.rs
  • Add unit test + two integration tests (bare call + with cursor param)

Closes #2826

Taimoor added 2 commits May 28, 2026 13:32
…arun preload CWD resolution (tinyhumansai#2822)

sharun resolves its --preload argument and library search paths relative
to the process CWD rather than the AppDir.  When a user launches
OpenHuman_0.56.0_amd64.AppImage from any directory other than the AppDir
(e.g. double-click from ~/Downloads), ld.so cannot find anylinux.so or
libcef.so even though SHARUN_DIR is set correctly.

Fix: add a new `patch_apprun_sharun_cwd` function to
scripts/release/strip-appimage-graphics-libs.sh that injects
`cd "$APPDIR" && ` before the `exec "$@"` line in the AppRun shell
script during the post-build repackaging step.  This guarantees that
CWD == AppDir by the time sharun runs, so relative preload/library
paths resolve correctly regardless of where the user launches from.

The patch:
- Only applies when the AppImage uses a sharun launcher (detected by
  the existing `uses_sharun_launcher` guard).
- Skips ELF-binary AppRun entries (cannot be sed-patched).
- Is idempotent (skips if `cd "$APPDIR"` is already present).
- Emits a clear warning if the exec line pattern is not found rather
  than silently missing the fix.
- Triggers a repack of the AppImage (same path as the loader/lib.path
  fixes) and is re-signed alongside other mutations.

Verified workaround from the bug report:
  sed -i 's|^        exec "\$@"|        cd "$APPDIR" \&\& exec "$@"|' squashfs-root/AppRun

This commit generalises that one-liner into the release pipeline so
future releases ship with the fix pre-applied.
Implements the missing `resources/templates/list` MCP method as specified in tinyhumansai#2826.
Compliant MCP clients (Claude Desktop, Cursor, Zed) probe this method after seeing
the `resources` capability in `initialize` and expect either a response or an error.

The OpenHuman MCP server currently advertises resources capability but omits this method,
causing clients to log -32601 (Method not found) errors. Since resource templates are
not currently exposed, this implementation correctly returns an empty `resourceTemplates` array.

Changes:
- Add `list_resource_templates_result()` helper in resources.rs
- Wire `resources/templates/list` handler in protocol.rs
- Add unit test for helper function
- Add two integration tests: bare call and with cursor parameter

Closes tinyhumansai#2826
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b2f580be-34b3-45c7-a01a-b548a91a6f7e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sanil-23
Copy link
Copy Markdown
Contributor

Closing as superseded by #2828 for issue #2826.

Both PRs implement the missing MCP resources/templates/list handler returning an empty resourceTemplates array (correct because the bundled prompt catalog is fully static / concrete URIs). #2828 is the more complete contribution:

  • Updates gitbooks/developing/mcp-server.md + the zh-CN mirror with a Resource Templates note
  • Extends the smoke-test snippet to exercise the new endpoint
  • Adds a new coverage matrix row 11.1.8 in docs/TEST-COVERAGE-MATRIX.md
  • Tolerates unknown/cursor params on the request (no spurious -32602)
  • Confirms the resources capability block stays unchanged

This PR is the larger diff (+130 vs +87) but doesn't carry docs or matrix updates, and a non-trivial fraction of the size is the test scaffold that #2828 reaches with less code via its handle_json_value wire-through approach.

Thanks for the contribution! If you spot anything #2828 misses (extra wire-test coverage, edge case in the request-param parsing), happy to surface it as a review comment on that PR.

@sanil-23 sanil-23 closed this May 28, 2026
@staimoorulhassan staimoorulhassan deleted the fix/mcp-resource-templates-list branch May 28, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP server returns -32601 for resources/templates/list

2 participants