Skip to content

Context7 Platform -- Up-to-date docs for AI agents

feat: Add tool annotations for improved LLM tool understanding (#1282)

Bryan Thompson93a2d5be83a8
diff --git a/.changeset/lemon-cameras-spend.md b/.changeset/lemon-cameras-spend.md
new file mode 100644
index 00000000..f62ae341
--- /dev/null
+++ b/.changeset/lemon-cameras-spend.md
@@ -0,0 +1,5 @@
+---
+"@upstash/context7-mcp": patch
+---
+
+Adds MCP tool annotations (readOnlyHint) to all tools to help MCP clients better understand tool behavior and make safer decisions about tool execution.
\ No newline at end of file
diff --git a/packages/mcp/src/index.ts b/packages/mcp/src/index.ts
index 14124299..ad83be08 100644
--- a/packages/mcp/src/index.ts
+++ b/packages/mcp/src/index.ts
@@ -142,6 +142,9 @@ IMPORTANT: Do not call this tool more than 3 times per question. If you cannot f
.string()
.describe("Library name to search for and retrieve a Context7-compatible library ID."),
},
+ annotations: {
+ readOnlyHint: true,
+ },
},
async ({ query, libraryName }) => {
const ctx = requestContext.getStore();
@@ -212,6 +215,9 @@ IMPORTANT: Do not call this tool more than 3 times per question. If you cannot f
"The question or task you need help with. Be specific and include relevant details. Good: 'How to set up authentication with JWT in Express.js' or 'React useEffect cleanup function examples'. Bad: 'auth' or 'hooks'. IMPORTANT: Do not include any sensitive or confidential information such as API keys, passwords, credentials, or personal data in your query."
),
},
+ annotations: {
+ readOnlyHint: true,
+ },
},
async ({ query, libraryId }) => {
const ctx = requestContext.getStore();