RedNote-MCP icon indicating copy to clipboard operation
RedNote-MCP copied to clipboard

feat: Add tool annotations for improved LLM tool understanding

Open bryankthompson opened this issue 11 months ago • 0 comments

Summary

Adds MCP tool annotations (readOnlyHint, openWorldHint, title) to all 4 tools to help LLMs better understand tool behavior and make safer decisions about tool execution.

Changes

Tool title readOnlyHint openWorldHint
search_notes "Search Notes" true true
get_note_content "Get Note Content" true true
get_note_comments "Get Note Comments" true true
login "Login" - true
  • Added readOnlyHint: true to read-only tools (search, get content, get comments)
  • Added openWorldHint: true to all tools (they interact with external Xiaohongshu API)
  • Added human-readable title annotations
  • Bumped @modelcontextprotocol/sdk from ^1.9.0 to 1.11.0 for annotation support
  • Fixed TypeScript type errors in stdioLogger.ts for SDK compatibility

Why This Matters

  • readOnlyHint enables MCP clients to auto-approve safe operations without user confirmation
  • openWorldHint indicates tools access external services, helping clients apply appropriate policies
  • title provides human-readable names for better tool display

Testing

  • [x] Build passes (npm run build)
  • [x] tools/list returns annotations for all 4 tools
  • [x] Annotation values match actual tool behavior

Before/After

Before:

{
  "name": "search_notes",
  "description": "根据关键词搜索笔记"
}

After:

{
  "name": "search_notes",
  "description": "根据关键词搜索笔记",
  "annotations": {
    "title": "Search Notes",
    "readOnlyHint": true,
    "openWorldHint": true
  }
}

🤖 Generated with Claude Code

bryankthompson avatar Jan 04 '26 15:01 bryankthompson