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);