Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
16 changes: 15 additions & 1 deletion src/linked-api-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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: [
Expand Down
39 changes: 39 additions & 0 deletions src/utils/read-only-tool-names.ts
Original file line number Diff line number Diff line change
@@ -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<string> = 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);
Loading