Skip to content

feat: Add tool annotations for improved LLM tool understanding#169

Merged
ksinder merged 1 commit into
makenotion:mainfrom
bryankthompson:feat/add-tool-annotations
Dec 26, 2025
Merged

feat: Add tool annotations for improved LLM tool understanding#169
ksinder merged 1 commit into
makenotion:mainfrom
bryankthompson:feat/add-tool-annotations

Conversation

@bryankthompson

Copy link
Copy Markdown
Contributor

Summary

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

Changes

  • Added readOnlyHint: true to GET operations (9 tools: get_user, get_users, get_self, retrieve_a_block, retrieve_a_page, retrieve_a_database, retrieve_a_page_property, retrieve_a_comment, get_block_children)
  • Added destructiveHint: true to POST/PATCH/DELETE operations (10 tools: post_database_query, post_search, patch_block_children, update_a_block, delete_a_block, patch_page, post_page, create_a_database, update_a_database, create_a_comment)
  • Added title annotations derived from operationId for human-readable display
  • Annotations are dynamically determined from OpenAPI spec HTTP methods

Why This Matters

  • Annotations provide semantic metadata that helps LLMs understand tool behavior
  • MCP clients like Claude Code can auto-approve read-only tools while prompting for confirmation on destructive operations
  • Enables safer tool execution by distinguishing read-only from destructive operations
  • Human-readable titles improve tool display in client UIs

Testing

  • Server builds successfully (npm run build)
  • All proxy tests pass (npx vitest run src/openapi-mcp-server/mcp/__tests__/)
  • Live verification: Started server and confirmed tools/list returns annotations for all 19 tools
  • Annotation values match HTTP methods (GET = readOnly, POST/PATCH/DELETE = destructive)

Example Output

Tool Name                                          Title                          ReadOnly   Destructive
----------------------------------------------------------------------------------------------------
API-get-user                                       Get User                       True       N/A       
API-retrieve-a-page                                Retrieve A Page                True       N/A       
API-post-page                                      Post Page                      N/A        True      
API-delete-a-block                                 Delete A Block                 N/A        True      

🤖 Generated with Claude Code

@ksinder

ksinder commented Dec 24, 2025

Copy link
Copy Markdown
Contributor

^ thanks, this looks great! mind rebasing off the latest main to pull the latest changes (including the CI action) before we merge?

Add readOnlyHint and destructiveHint annotations to all 19 tools based on
HTTP method to help LLMs better understand tool behavior and make safer decisions.

Changes:
- Added readOnlyHint: true to GET operations (9 tools)
- Added destructiveHint: true to POST/PATCH/DELETE operations (10 tools)
- Added title annotations derived from operationId for human-readable display
- Annotations are dynamically determined from OpenAPI spec HTTP methods

This improves tool safety metadata for MCP clients like Claude Code,
enabling features like auto-approval for read-only operations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@bryankthompson bryankthompson force-pushed the feat/add-tool-annotations branch from cd8f13c to 15ac6e7 Compare December 25, 2025 02:24
@bryankthompson

Copy link
Copy Markdown
Contributor Author

Done! Rebased onto the latest main - build passes locally. Ready for merge when you are.

@ksinder ksinder merged commit 8358ff0 into makenotion:main Dec 26, 2025
8 checks passed
markjamesbtutoring-coder added a commit to markjamesbtutoring-coder/notion-mcp-server that referenced this pull request Jan 29, 2026
jyoansah pushed a commit to drapesinc/notion-mcp that referenced this pull request Feb 2, 2026
jyoansah added a commit to drapesinc/notion-mcp that referenced this pull request Feb 2, 2026
Merged 63 commits from upstream bringing:
- feat: Add retrieve database endpoint to OpenAPI spec (makenotion#195)
- feat: Add option to disable authentication (makenotion#105)
- fix: preserve const values and allow any property in page schemas (makenotion#173)
- fix: handle double-serialized JSON parameters from MCP clients (makenotion#180)
- feat: Add tool annotations for improved LLM tool understanding (makenotion#169)
- feat: add streamable HTTP transport and NOTION_TOKEN env var support (makenotion#75)

Preserved our customizations:
- Multi-workspace support with NOTION_TOKEN_* env vars
- Custom unified tools (notion-page, notion-blocks, etc.)
- get-due-tasks with assignee filtering and dual date property checking
- Toolset configuration and filtering

Merged deserializeParams fix into our multi-workspace flow.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.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.

3 participants