fix(mcp): annotate tool safety hints for ChatGPT by Dhravya · Pull Request #1330 · supermemoryai/supermemory · GitHub
Skip to content

fix(mcp): annotate tool safety hints for ChatGPT - #1330

Merged
Dhravya merged 1 commit into
mainfrom
vorflux/chatgpt-mcp-tool-annotations
Jul 21, 2026
Merged

Dhravya merged 1 commit into
mainfrom
vorflux/chatgpt-mcp-tool-annotations

Conversation

@Dhravya

@Dhravya Dhravya commented Jul 21, 2026 •

Copy link
Copy Markdown
Member

Note

Low Risk
Metadata-only changes on tool registration with no change to handler logic or API behavior.

Overview
Adds MCP tool annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint) so hosts like ChatGPT can tell safe read tools from mutating ones.

memory is marked destructive and not read-only/idempotent. recall, listMemories, listProjects, whoAmI, memory-graph, and fetch-graph-data share a read-only, non-destructive profile.

Discovery e2e tests now assert those hints on listTools() and include listMemories in the expected tool list; the redundant discovery check was removed from list-memories.test.ts.

Reviewed by Cursor Bugbot for commit c955d58. Bugbot is set up for automated code reviews on this repo. Configure here.

Add MCP tool safety annotations so ChatGPT can classify listMemories / “List all memories” as read-only instead of conservatively blocking it.

Changes

  • Mark read-only MCP tools (recall, listMemories, listProjects, whoAmI, memory-graph, fetch-graph-data) as non-destructive and idempotent.
  • Conservatively mark the mixed memory save/forget tool as mutating and destructive because it supports forgetting data.
  • Consolidate tool-discovery coverage and assert the annotations emitted through tools/list.

Rollout note

After production promotion, the affected customer may need to remove and re-add or reconnect the ChatGPT app so ChatGPT re-reads the MCP tool metadata.

The Cloudflare PR build uploaded Worker version 2051 for commit c955d588, but the version has no preview route and production remains routed to version 2050. Production annotation verification is therefore pending merge/promotion.

Testing

  • Passed official MCP Inspector CLI against the local branch Worker:
    • ~/.bun/bin/bunx @modelcontextprotocol/inspector --cli http://localhost:8788/mcp --transport http --method tools/list --header "Authorization: Bearer $SUPERMEMORY_API_KEY"
    • Inspector returned all 7 tools; all 7 annotations matched the intended classifications.
    • listMemories emitted { readOnlyHint:true, destructiveHint:false, idempotentHint:true, openWorldHint:false }.
  • Passed after rebasing onto current origin/main:
    • cd apps/mcp && PATH="$HOME/.bun/bin:$PATH" ~/.bun/bin/bun run build:ui
    • SUPERMEMORY_MCP_URL=http://localhost:8788/mcp ~/.bun/bin/bun run test:e2e e2e/discovery.test.ts -t "expected tools|marks read-only|marks memory"
    • Result: 1 file passed; 3 tests passed; 4 skipped.
  • Passed: ~/.bun/bin/bunx biome check --write apps/mcp/src/server.ts apps/mcp/e2e/discovery.test.ts apps/mcp/e2e/list-memories.test.ts
  • Passed: git diff --check origin/main...HEAD
  • Independently confirmed runtime tools/list annotations against the local branch Worker.
  • Partial: full e2e/list-memories.test.ts live ingestion timed out waiting for a new memory. Discovery metadata relevant to this fix passed independently.
  • Partial: the default-heap TypeScript check OOMed. The 8 GB retry reported broader apps/mcp type/configuration issues involving duplicate MCP SDK types, Zod schema incompatibilities, a missing d3-force-3d declaration, and missing DOM libs.
  • Expected pre-promotion result: the production smoke test against mcp.supermemory.ai still returned the old metadata because Cloudflare shows production on version 2050, not PR version 2051.
  • Process note: simplify, review, and testing subagents initially each failed once with An internal error occurred. Please try again. If this issue persists, please contact support. All were retried successfully; simplify feedback was applied, review found no blockers, and testing reported partial for the limitations above.

Session Details

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Dhravya commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

How to use the Graphite Merge Queue

Add the label Main to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
supermemory-app c955d58 Commit Preview URL

Branch Preview URL
Jul 21 2026, 09:29 PM

@claude

claude Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview: Adds MCP tool safety annotations (hints for AI clients like ChatGPT) to distinguish read-only tools from mutating tools.

Issues found: None — this looks good to ship.

The implementation is correct:

  • Read-only tools (recall, listMemories, listProjects, whoAmI, memory-graph, fetch-graph-data) are properly marked as non-destructive and idempotent
  • The memory tool is correctly marked as destructive and non-idempotent since it can save/forget data
  • Tests verify the annotations are applied correctly
  • Redundant discovery test was removed from list-memories.test.ts since listMemories is now covered in discovery.test.ts

Score: 10/10

@Dhravya
Dhravya merged commit 816b85d into main Jul 21, 2026
11 checks passed
cursor Bot pushed a commit that referenced this pull request Jul 23, 2026
Keep the revamped modular MCP (drop legacy apps/mcp/src/server.ts) while
porting ChatGPT tool safety annotations from #1330. Resolve docs conflicts
by accepting main's MCP overview rewrite with OAuth-only auth from this
branch, and delete the removed introduction page.

Co-authored-by: Dhravya Shah <dhravya@supermemory.com>
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.

1 participant