From 7033162fb31e3eeb599a557ce3feefd24818057c Mon Sep 17 00:00:00 2001 From: vprudnikoff Date: Wed, 4 Nov 2026 18:34:23 +0000 Subject: [PATCH] Annotate tools with readOnlyHint and openWorldHint ChatGPT treats a tool without readOnlyHint as a write and gates every call behind a confirmation; on Pro, custom MCP servers may use read tools only. Every tool now carries openWorldHint: true, and readOnlyHint: true for the 33 that change nothing on the LinkedIn account or in Linked API (fetches, searches, retrievals, stored inbox and network reads, workflow results, usage, changelog, admin reads). Syncs and get_conversation stay writes: they can open conversations on LinkedIn, which marks them read. A new tool defaults to a write. --- package-lock.json | 4 ++-- package.json | 2 +- src/linked-api-server.ts | 16 ++++++++++++- src/utils/read-only-tool-names.ts | 39 +++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 src/utils/read-only-tool-names.ts diff --git a/package-lock.json b/package-lock.json index 2d76a6c..8b37226 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@linkedapi/mcp", - "version": "2.3.23", + "version": "2.3.24", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@linkedapi/mcp", - "version": "2.3.23", + "version": "2.3.24", "license": "MIT", "dependencies": { "@linkedapi/node": "^2.3.21", diff --git a/package.json b/package.json index fed12a2..3e0f189 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@linkedapi/mcp", - "version": "2.3.23", + "version": "2.3.24", "description": "MCP server that lets AI assistants control LinkedIn accounts and retrieve real-time data.", "main": "dist/index.js", "bin": { diff --git a/src/linked-api-server.ts b/src/linked-api-server.ts index e802563..0c7bf7e 100644 --- a/src/linked-api-server.ts +++ b/src/linked-api-server.ts @@ -5,6 +5,7 @@ import { Tool } from '@modelcontextprotocol/sdk/types.js'; import { LinkedApiTools } from './linked-api-tools'; import { handleLinkedApiError } from './utils/handle-linked-api-error'; import { logger } from './utils/logger'; +import { READ_ONLY_TOOL_NAMES } from './utils/read-only-tool-names'; import { CallToolResult, ExtendedCallToolRequest } from './utils/types'; const BACKGROUND_WORKFLOW_DESCRIPTION = @@ -42,7 +43,9 @@ export class LinkedApiMCPServer { }); const adminTools = this.tools.adminTools.map((tool) => tool.getTool()); const publicTools = this.tools.publicTools.map((tool) => tool.getTool()); - return [...linkedApiTools, ...adminTools, ...publicTools]; + return [...linkedApiTools, ...adminTools, ...publicTools].map((definition) => + this.annotate(definition), + ); } public async executeWithTokens( @@ -215,6 +218,17 @@ export class LinkedApiMCPServer { } } + private annotate(definition: Tool): Tool { + return { + ...definition, + annotations: { + ...definition.annotations, + readOnlyHint: READ_ONLY_TOOL_NAMES.has(definition.name), + openWorldHint: true, + }, + }; + } + private text(text: string): CallToolResult { return { content: [ diff --git a/src/utils/read-only-tool-names.ts b/src/utils/read-only-tool-names.ts new file mode 100644 index 0000000..39423c8 --- /dev/null +++ b/src/utils/read-only-tool-names.ts @@ -0,0 +1,39 @@ +// Tools that change nothing on the LinkedIn account or in Linked API. ChatGPT gates every tool +// without readOnlyHint behind a write confirmation, and Pro plans may call only read tools, so a +// tool missing from this list is treated as a write – the safe default for a new tool. Syncs and +// get_conversation stay out: they can open conversations on LinkedIn, which marks them read. +export const READ_ONLY_TOOL_NAMES: ReadonlySet = new Set([ + 'admin_get_accounts', + 'admin_get_connection_session', + 'admin_get_limits', + 'admin_get_limits_defaults', + 'admin_get_limits_usage', + 'admin_get_seats', + 'admin_get_subscription_status', + 'check_connection_status', + 'fetch_company', + 'fetch_job', + 'fetch_person', + 'fetch_post', + 'get_api_usage', + 'get_changelog', + 'get_inbox', + 'get_network', + 'get_workflow_result', + 'nv_fetch_company', + 'nv_fetch_person', + 'nv_retrieve_alerts', + 'nv_search_companies', + 'nv_search_people', + 'retrieve_connections', + 'retrieve_feed', + 'retrieve_invitations', + 'retrieve_pending_requests', + 'retrieve_performance', + 'retrieve_profile_viewers', + 'retrieve_ssi', + 'search_companies', + 'search_jobs', + 'search_people', + 'search_posts', +] as const);