@linkedapi/mcp 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/index.js +19 -9
- package/dist/index.js.map +1 -1
- package/dist/linked-api-server.d.ts +8 -5
- package/dist/linked-api-server.d.ts.map +1 -1
- package/dist/linked-api-server.js +63 -49
- package/dist/linked-api-server.js.map +1 -1
- package/dist/linked-api-tools.d.ts +17 -5
- package/dist/linked-api-tools.d.ts.map +1 -1
- package/dist/linked-api-tools.js +28 -28
- package/dist/linked-api-tools.js.map +1 -1
- package/dist/prompts/index.d.ts +2 -2
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +3 -1
- package/dist/prompts/index.js.map +1 -1
- package/dist/tools/comment-on-post.d.ts.map +1 -1
- package/dist/tools/comment-on-post.js +1 -1
- package/dist/tools/comment-on-post.js.map +1 -1
- package/dist/tools/create-post.js +1 -1
- package/dist/tools/create-post.js.map +1 -1
- package/dist/tools/execute-custom-workflow.d.ts.map +1 -1
- package/dist/tools/execute-custom-workflow.js +1 -1
- package/dist/tools/execute-custom-workflow.js.map +1 -1
- package/dist/tools/get-api-usage-stats.d.ts +0 -2
- package/dist/tools/get-api-usage-stats.d.ts.map +1 -1
- package/dist/tools/get-api-usage-stats.js.map +1 -1
- package/dist/tools/get-conversation.d.ts +3 -4
- package/dist/tools/get-conversation.d.ts.map +1 -1
- package/dist/tools/get-conversation.js +7 -6
- package/dist/tools/get-conversation.js.map +1 -1
- package/dist/tools/get-workflow-result.d.ts +6 -4
- package/dist/tools/get-workflow-result.d.ts.map +1 -1
- package/dist/tools/get-workflow-result.js +37 -10
- package/dist/tools/get-workflow-result.js.map +1 -1
- package/dist/tools/nv-get-conversation.d.ts +3 -4
- package/dist/tools/nv-get-conversation.d.ts.map +1 -1
- package/dist/tools/nv-get-conversation.js +7 -6
- package/dist/tools/nv-get-conversation.js.map +1 -1
- package/dist/tools/nv-send-message.js +1 -1
- package/dist/tools/nv-send-message.js.map +1 -1
- package/dist/tools/react-to-post.js +1 -1
- package/dist/tools/react-to-post.js.map +1 -1
- package/dist/tools/remove-connection.js +1 -1
- package/dist/tools/remove-connection.js.map +1 -1
- package/dist/tools/send-connection-request.js +1 -1
- package/dist/tools/send-connection-request.js.map +1 -1
- package/dist/tools/send-message.d.ts.map +1 -1
- package/dist/tools/send-message.js +1 -1
- package/dist/tools/send-message.js.map +1 -1
- package/dist/tools/withdraw-connection-request.js +1 -1
- package/dist/tools/withdraw-connection-request.js.map +1 -1
- package/dist/types/linked-api-tool-result.type.d.ts +6 -0
- package/dist/types/linked-api-tool-result.type.d.ts.map +1 -0
- package/dist/types/linked-api-tool-result.type.js +3 -0
- package/dist/types/linked-api-tool-result.type.js.map +1 -0
- package/dist/utils/define-request-timeout.d.ts.map +1 -1
- package/dist/utils/define-request-timeout.js +16 -4
- package/dist/utils/define-request-timeout.js.map +1 -1
- package/dist/utils/handle-linked-api-error.d.ts +1 -1
- package/dist/utils/handle-linked-api-error.d.ts.map +1 -1
- package/dist/utils/handle-linked-api-error.js +0 -9
- package/dist/utils/handle-linked-api-error.js.map +1 -1
- package/dist/utils/json-http-transport.d.ts.map +1 -1
- package/dist/utils/json-http-transport.js +4 -3
- package/dist/utils/json-http-transport.js.map +1 -1
- package/dist/utils/linked-api-tool.d.ts +10 -16
- package/dist/utils/linked-api-tool.d.ts.map +1 -1
- package/dist/utils/linked-api-tool.js +4 -10
- package/dist/utils/linked-api-tool.js.map +1 -1
- package/dist/utils/types.d.ts +0 -6
- package/dist/utils/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +19 -11
- package/src/linked-api-server.ts +83 -57
- package/src/linked-api-tools.ts +45 -32
- package/src/prompts/index.ts +3 -1
- package/src/tools/comment-on-post.ts +2 -1
- package/src/tools/create-post.ts +1 -1
- package/src/tools/execute-custom-workflow.ts +2 -1
- package/src/tools/get-api-usage-stats.ts +0 -2
- package/src/tools/get-conversation.ts +13 -10
- package/src/tools/get-workflow-result.ts +63 -17
- package/src/tools/nv-get-conversation.ts +13 -10
- package/src/tools/nv-send-message.ts +1 -1
- package/src/tools/react-to-post.ts +1 -1
- package/src/tools/remove-connection.ts +1 -1
- package/src/tools/send-connection-request.ts +1 -1
- package/src/tools/send-message.ts +2 -1
- package/src/tools/withdraw-connection-request.ts +1 -1
- package/src/types/linked-api-tool-result.type.ts +12 -0
- package/src/utils/define-request-timeout.ts +16 -4
- package/src/utils/handle-linked-api-error.ts +2 -10
- package/src/utils/json-http-transport.ts +4 -3
- package/src/utils/linked-api-tool.ts +16 -32
- package/src/utils/types.ts +0 -6
- package/dist/utils/execute-with-progress.d.ts +0 -8
- package/dist/utils/execute-with-progress.d.ts.map +0 -1
- package/dist/utils/execute-with-progress.js +0 -75
- package/dist/utils/execute-with-progress.js.map +0 -1
- package/src/utils/execute-with-progress.ts +0 -93
package/README.md
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
Linked API MCP server connects your LinkedIn account to AI assistants like Claude, Cursor, and VS Code. Ask them to search for leads, send messages, analyze profiles, and much more – they'll handle it through our cloud browser, safely and automatically.
|
|
2
2
|
|
|
3
3
|
## Use cases
|
|
4
|
+
|
|
4
5
|
- **Sales automation assistant**. Ask your AI to find leads, check their profiles, and draft personalized outreach. It can search for "software engineers at companies with 50-200 employees in San Francisco", analyze their backgrounds, and suggest connection messages that actually make sense.
|
|
5
6
|
- **Recruitment assistant**. Let your assistant search for candidates with specific skills, review their experience, and send initial outreach. It handles the time-consuming parts while you focus on actually talking to people.
|
|
6
7
|
- **Conversation assistant**. Your AI can read your existing LinkedIn conversations and help you respond naturally. It understands the context of your chats, suggests relevant replies, and can even send follow-up messages.
|
|
7
8
|
- **Market research assistant**. Need competitor analysis? Your assistant can gather data about companies, their employees, and recent activities. Get insights about industry trends without spending hours on LinkedIn.
|
|
8
9
|
|
|
9
10
|
## Get started
|
|
11
|
+
|
|
10
12
|
To start using Linked API MCP, spend 2 minutes reading these essential guides:
|
|
11
13
|
|
|
12
14
|
1. [Installation](https://linkedapi.io/mcp/installation/) – set up MCP in Claude, Cursor, VS Code, or Windsurf.
|
|
13
15
|
2. [Available tools](https://linkedapi.io/mcp/available-tools/) – explore all the LinkedIn tools your assistant can call.
|
|
14
16
|
3. [Usage examples](https://linkedapi.io/mcp/usage-examples/) – see real-world examples to get you started quickly.
|
|
15
17
|
|
|
18
|
+
## Long-running actions
|
|
19
|
+
|
|
20
|
+
Linked API actions run through a cloud browser and are queued like normal automation. Many actions take several minutes, especially searches and profile fetches with optional data.
|
|
21
|
+
|
|
22
|
+
If a tool returns `status`, `workflowId`, `operationName`, and `message`, the action is still running. Do not retry the original tool because that can queue duplicate work. Call `get_workflow_result` with the exact `workflowId` and `operationName` until the final result is returned. By default `get_workflow_result` long-polls until the workflow completes or the current MCP client's request budget elapses; pass `waitSeconds: 0` for an immediate single-shot snapshot.
|
|
23
|
+
|
|
16
24
|
## License
|
|
25
|
+
|
|
17
26
|
This project is licensed under the MIT – see the [LICENSE](https://github.com/Linked-API/linkedapi-mcp/blob/main/LICENSE) file for details.
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,12 @@ const json_http_transport_1 = require("./utils/json-http-transport");
|
|
|
14
14
|
const logger_1 = require("./utils/logger");
|
|
15
15
|
function deriveClientFromUserAgent(userAgent) {
|
|
16
16
|
const ua = userAgent.toLowerCase();
|
|
17
|
+
if (ua.includes('codex'))
|
|
18
|
+
return 'codex';
|
|
19
|
+
if (ua.includes('claude-code') || ua.includes('claude code'))
|
|
20
|
+
return 'claude-code';
|
|
21
|
+
if (ua.includes('claude') || ua.includes('anthropic'))
|
|
22
|
+
return 'claude';
|
|
17
23
|
if (ua.includes('cursor'))
|
|
18
24
|
return 'cursor';
|
|
19
25
|
if (ua.includes('windsurf'))
|
|
@@ -33,6 +39,13 @@ function deriveClientFromUserAgent(userAgent) {
|
|
|
33
39
|
return 'browser';
|
|
34
40
|
return userAgent;
|
|
35
41
|
}
|
|
42
|
+
function normalizeHeaderValue(value) {
|
|
43
|
+
if (Array.isArray(value)) {
|
|
44
|
+
return value.find((item) => item.trim().length > 0)?.trim();
|
|
45
|
+
}
|
|
46
|
+
const normalizedValue = value?.trim();
|
|
47
|
+
return normalizedValue && normalizedValue.length > 0 ? normalizedValue : undefined;
|
|
48
|
+
}
|
|
36
49
|
function getArgValue(flag) {
|
|
37
50
|
const index = process.argv.indexOf(flag);
|
|
38
51
|
if (index === -1)
|
|
@@ -57,8 +70,7 @@ async function main() {
|
|
|
57
70
|
},
|
|
58
71
|
instructions: prompts_1.systemPrompt,
|
|
59
72
|
});
|
|
60
|
-
const
|
|
61
|
-
const linkedApiServer = new linked_api_server_1.LinkedApiMCPServer(progressCallback);
|
|
73
|
+
const linkedApiServer = new linked_api_server_1.LinkedApiMCPServer();
|
|
62
74
|
server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
|
|
63
75
|
const tools = linkedApiServer.getTools();
|
|
64
76
|
return {
|
|
@@ -103,14 +115,12 @@ async function main() {
|
|
|
103
115
|
const localLinkedApiToken = process.env.LINKED_API_TOKEN;
|
|
104
116
|
const localIdentificationToken = process.env.IDENTIFICATION_TOKEN;
|
|
105
117
|
const headers = extra?.requestInfo?.headers ?? {};
|
|
106
|
-
const linkedApiToken = (headers['linked-api-token'] ?? localLinkedApiToken ?? ''
|
|
107
|
-
const identificationToken = (headers['identification-token'] ??
|
|
108
|
-
|
|
109
|
-
'');
|
|
110
|
-
let mcpClient = (headers['client'] ?? '');
|
|
118
|
+
const linkedApiToken = normalizeHeaderValue(headers['linked-api-token']) ?? localLinkedApiToken ?? '';
|
|
119
|
+
const identificationToken = normalizeHeaderValue(headers['identification-token']) ?? localIdentificationToken ?? '';
|
|
120
|
+
let mcpClient = normalizeHeaderValue(headers['client']) ?? '';
|
|
111
121
|
if (!mcpClient) {
|
|
112
|
-
const userAgentHeader = headers['user-agent'];
|
|
113
|
-
if (
|
|
122
|
+
const userAgentHeader = normalizeHeaderValue(headers['user-agent']);
|
|
123
|
+
if (userAgentHeader) {
|
|
114
124
|
mcpClient = deriveClientFromUserAgent(userAgentHeader);
|
|
115
125
|
}
|
|
116
126
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AACA,wEAAmE;AACnE,wEAAiF;AACjF,iEAK4C;AAC5C,0DAA6B;AAE7B,2DAAyD;AACzD,uCAA6E;AAC7E,qEAAsE;AACtE,2CAAwC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AACA,wEAAmE;AACnE,wEAAiF;AACjF,iEAK4C;AAC5C,0DAA6B;AAE7B,2DAAyD;AACzD,uCAA6E;AAC7E,qEAAsE;AACtE,2CAAwC;AAExC,SAAS,yBAAyB,CAAC,SAAiB;IAClD,MAAM,EAAE,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;IACnC,IAAI,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IACzC,IAAI,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC;QAAE,OAAO,aAAa,CAAC;IACnF,IAAI,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC;QAAE,OAAO,QAAQ,CAAC;IACvE,IAAI,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC3C,IAAI,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC;QAAE,OAAO,UAAU,CAAC;IAC/C,IAAI,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;QAAE,OAAO,QAAQ,CAAC;IAChF,I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C,KAAK,CAAC;iBAC9D,EACD,8BAA8B,CAC/B,CAAC;gBACF,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC;gBACrB,GAAG,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;YACnC,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE;YACjC,eAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,oCAAoC,IAAI,EAAE,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;QAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAChC,eAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,eAAM,CAAC,KAAK,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { TLinkedApiConfig } from '@linkedapi/node';
|
|
2
2
|
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
-
import { CallToolResult, ExtendedCallToolRequest
|
|
3
|
+
import { CallToolResult, ExtendedCallToolRequest } from './utils/types';
|
|
4
|
+
interface TExecuteWithTokensOptions extends TLinkedApiConfig {
|
|
5
|
+
mcpClient: string;
|
|
6
|
+
}
|
|
4
7
|
export declare class LinkedApiMCPServer {
|
|
5
8
|
private tools;
|
|
6
|
-
constructor(
|
|
9
|
+
constructor();
|
|
7
10
|
getTools(): Tool[];
|
|
8
|
-
executeWithTokens(request: ExtendedCallToolRequest['params'], { linkedApiToken, identificationToken, mcpClient }:
|
|
9
|
-
|
|
10
|
-
}): Promise<CallToolResult>;
|
|
11
|
+
executeWithTokens(request: ExtendedCallToolRequest['params'], { linkedApiToken, identificationToken, mcpClient }: TExecuteWithTokensOptions): Promise<CallToolResult>;
|
|
12
|
+
private text;
|
|
11
13
|
private calculateDuration;
|
|
12
14
|
}
|
|
15
|
+
export {};
|
|
13
16
|
//# sourceMappingURL=linked-api-server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linked-api-server.d.ts","sourceRoot":"","sources":["../src/linked-api-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6C,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAE9F,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"linked-api-server.d.ts","sourceRoot":"","sources":["../src/linked-api-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6C,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAE9F,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAK1D,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAMxE,UAAU,yBAA0B,SAAQ,gBAAgB;IAC1D,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,KAAK,CAAiB;;IAMvB,QAAQ,IAAI,IAAI,EAAE;IAgBZ,iBAAiB,CAC5B,OAAO,EAAE,uBAAuB,CAAC,QAAQ,CAAC,EAC1C,EAAE,cAAc,EAAE,mBAAmB,EAAE,SAAS,EAAE,EAAE,yBAAyB,GAC5E,OAAO,CAAC,cAAc,CAAC;IAqJ1B,OAAO,CAAC,IAAI;IAWZ,OAAO,CAAC,iBAAiB;CAI1B"}
|
|
@@ -4,50 +4,59 @@ exports.LinkedApiMCPServer = void 0;
|
|
|
4
4
|
const node_1 = require("@linkedapi/node");
|
|
5
5
|
const core_1 = require("@linkedapi/node/dist/core");
|
|
6
6
|
const linked_api_tools_1 = require("./linked-api-tools");
|
|
7
|
-
const define_request_timeout_1 = require("./utils/define-request-timeout");
|
|
8
7
|
const handle_linked_api_error_1 = require("./utils/handle-linked-api-error");
|
|
9
8
|
const logger_1 = require("./utils/logger");
|
|
9
|
+
const BACKGROUND_WORKFLOW_DESCRIPTION = `Linked API actions are queued into a cloud-browser workflow and may take several minutes. The server returns immediately after starting the workflow with {status: 'pending'|'running', workflowId, operationName, message}. To retrieve the final result, call get_workflow_result with the returned workflowId and operationName — it will long-poll until completion or the request budget elapses, then return either the final result or another in-progress snapshot. Do not retry the original tool while a workflow is still running; that creates duplicate queued work.`;
|
|
10
|
+
const NON_WORKFLOW_TOOL_NAMES = new Set(['get_workflow_result', 'get_api_usage']);
|
|
10
11
|
class LinkedApiMCPServer {
|
|
11
12
|
tools;
|
|
12
|
-
constructor(
|
|
13
|
-
this.tools = new linked_api_tools_1.LinkedApiTools(
|
|
13
|
+
constructor() {
|
|
14
|
+
this.tools = new linked_api_tools_1.LinkedApiTools();
|
|
14
15
|
}
|
|
15
16
|
getTools() {
|
|
16
|
-
const linkedApiTools = this.tools.tools.map((tool) =>
|
|
17
|
+
const linkedApiTools = this.tools.tools.map((tool) => {
|
|
18
|
+
const definition = tool.getTool();
|
|
19
|
+
if (NON_WORKFLOW_TOOL_NAMES.has(definition.name)) {
|
|
20
|
+
return definition;
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
...definition,
|
|
24
|
+
description: `${definition.description}\n\n${BACKGROUND_WORKFLOW_DESCRIPTION}`,
|
|
25
|
+
};
|
|
26
|
+
});
|
|
17
27
|
const adminTools = this.tools.adminTools.map((tool) => tool.getTool());
|
|
18
28
|
return [...linkedApiTools, ...adminTools];
|
|
19
29
|
}
|
|
20
30
|
async executeWithTokens(request, { linkedApiToken, identificationToken, mcpClient }) {
|
|
21
|
-
const workflowTimeout = (0, define_request_timeout_1.defineRequestTimeoutInSeconds)(mcpClient) * 1000;
|
|
22
31
|
logger_1.logger.info({
|
|
23
32
|
toolName: request.name,
|
|
24
33
|
arguments: request.arguments,
|
|
25
34
|
mcpClient,
|
|
26
|
-
workflowTimeout,
|
|
27
35
|
}, 'Tool execution started');
|
|
28
|
-
const { name: toolName, arguments: args
|
|
29
|
-
const progressToken = _meta?.progressToken;
|
|
36
|
+
const { name: toolName, arguments: args } = request;
|
|
30
37
|
const startTime = Date.now();
|
|
31
38
|
try {
|
|
32
39
|
const adminTool = this.tools.adminToolByName(toolName);
|
|
33
40
|
if (adminTool) {
|
|
34
|
-
const admin = new node_1.LinkedApiAdmin({
|
|
35
|
-
|
|
41
|
+
const admin = new node_1.LinkedApiAdmin({
|
|
42
|
+
linkedApiToken,
|
|
43
|
+
client: 'mcp',
|
|
44
|
+
});
|
|
36
45
|
const params = adminTool.validate(args);
|
|
37
|
-
const result = await adminTool.execute({
|
|
38
|
-
|
|
46
|
+
const result = await adminTool.execute({
|
|
47
|
+
admin,
|
|
48
|
+
args: params,
|
|
49
|
+
});
|
|
39
50
|
const duration = this.calculateDuration(startTime);
|
|
40
|
-
logger_1.logger.info({
|
|
51
|
+
logger_1.logger.info({
|
|
52
|
+
toolName,
|
|
41
53
|
duration,
|
|
42
|
-
data: result
|
|
54
|
+
data: result,
|
|
55
|
+
}, 'Tool execution successful');
|
|
43
56
|
if (result === undefined) {
|
|
44
|
-
return
|
|
45
|
-
text: 'Completed' }] };
|
|
57
|
+
return this.text('Completed');
|
|
46
58
|
}
|
|
47
|
-
return
|
|
48
|
-
content: [{ type: 'text',
|
|
49
|
-
text: JSON.stringify(result, null, 2) }],
|
|
50
|
-
};
|
|
59
|
+
return this.text(JSON.stringify(result, null, 2));
|
|
51
60
|
}
|
|
52
61
|
const linkedapi = new node_1.LinkedApi((0, core_1.buildLinkedApiHttpClient)({
|
|
53
62
|
linkedApiToken: linkedApiToken,
|
|
@@ -58,14 +67,27 @@ class LinkedApiMCPServer {
|
|
|
58
67
|
throw new Error(`Unknown tool: ${toolName}`);
|
|
59
68
|
}
|
|
60
69
|
const params = tool.validate(args);
|
|
61
|
-
const
|
|
70
|
+
const result = await tool.execute({
|
|
62
71
|
linkedapi,
|
|
63
72
|
args: params,
|
|
64
|
-
|
|
65
|
-
progressToken,
|
|
73
|
+
mcpClient,
|
|
66
74
|
});
|
|
67
|
-
const
|
|
68
|
-
|
|
75
|
+
const duration = this.calculateDuration(startTime);
|
|
76
|
+
if ('workflowStatus' in result) {
|
|
77
|
+
const inProgressBody = {
|
|
78
|
+
status: result.workflowStatus,
|
|
79
|
+
workflowId: result.workflowId,
|
|
80
|
+
operationName: result.operationName,
|
|
81
|
+
message: result.message,
|
|
82
|
+
};
|
|
83
|
+
logger_1.logger.info({
|
|
84
|
+
toolName,
|
|
85
|
+
duration,
|
|
86
|
+
body: inProgressBody,
|
|
87
|
+
}, 'Tool execution returned in-progress snapshot');
|
|
88
|
+
return this.text(JSON.stringify(inProgressBody, null, 2));
|
|
89
|
+
}
|
|
90
|
+
const { data, errors } = result;
|
|
69
91
|
if (errors.length > 0 && !data) {
|
|
70
92
|
logger_1.logger.error({
|
|
71
93
|
toolName,
|
|
@@ -73,6 +95,7 @@ class LinkedApiMCPServer {
|
|
|
73
95
|
errors,
|
|
74
96
|
}, 'Tool execution failed');
|
|
75
97
|
return {
|
|
98
|
+
isError: true,
|
|
76
99
|
content: [
|
|
77
100
|
{
|
|
78
101
|
type: 'text',
|
|
@@ -87,23 +110,9 @@ class LinkedApiMCPServer {
|
|
|
87
110
|
data,
|
|
88
111
|
}, 'Tool execution successful');
|
|
89
112
|
if (data) {
|
|
90
|
-
return
|
|
91
|
-
content: [
|
|
92
|
-
{
|
|
93
|
-
type: 'text',
|
|
94
|
-
text: JSON.stringify(data, null, 2),
|
|
95
|
-
},
|
|
96
|
-
],
|
|
97
|
-
};
|
|
113
|
+
return this.text(JSON.stringify(data, null, 2));
|
|
98
114
|
}
|
|
99
|
-
return
|
|
100
|
-
content: [
|
|
101
|
-
{
|
|
102
|
-
type: 'text',
|
|
103
|
-
text: 'Completed',
|
|
104
|
-
},
|
|
105
|
-
],
|
|
106
|
-
};
|
|
115
|
+
return this.text('Completed');
|
|
107
116
|
}
|
|
108
117
|
catch (error) {
|
|
109
118
|
const duration = this.calculateDuration(startTime);
|
|
@@ -121,6 +130,8 @@ class LinkedApiMCPServer {
|
|
|
121
130
|
text: JSON.stringify(body, null, 2),
|
|
122
131
|
},
|
|
123
132
|
],
|
|
133
|
+
structuredContent: body,
|
|
134
|
+
isError: true,
|
|
124
135
|
};
|
|
125
136
|
}
|
|
126
137
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -130,16 +141,19 @@ class LinkedApiMCPServer {
|
|
|
130
141
|
error: errorMessage,
|
|
131
142
|
stack: error instanceof Error ? error.stack : undefined,
|
|
132
143
|
}, 'Tool execution failed with unknown error');
|
|
133
|
-
return {
|
|
134
|
-
content: [
|
|
135
|
-
{
|
|
136
|
-
type: 'text',
|
|
137
|
-
text: `Error executing ${toolName}: ${errorMessage}`,
|
|
138
|
-
},
|
|
139
|
-
],
|
|
140
|
-
};
|
|
144
|
+
return this.text(`Error executing ${toolName}: ${errorMessage}`);
|
|
141
145
|
}
|
|
142
146
|
}
|
|
147
|
+
text(text) {
|
|
148
|
+
return {
|
|
149
|
+
content: [
|
|
150
|
+
{
|
|
151
|
+
type: 'text',
|
|
152
|
+
text,
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
};
|
|
156
|
+
}
|
|
143
157
|
calculateDuration(startTime) {
|
|
144
158
|
const endTime = Date.now();
|
|
145
159
|
return `${((endTime - startTime) / 1000).toFixed(2)} seconds`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linked-api-server.js","sourceRoot":"","sources":["../src/linked-api-server.ts"],"names":[],"mappings":";;;AAAA,0CAA8F;AAC9F,oDAAqE;AAGrE,yDAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"linked-api-server.js","sourceRoot":"","sources":["../src/linked-api-server.ts"],"names":[],"m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AAQ,KAAK,YAAY,EAAE,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAEO,IAAI,CAAC,IAAY;QACvB,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI;iBACL;aACF;SACF,CAAC;IACJ,CAAC;IAEO,iBAAiB,CAAC,SAAiB;QACzC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC3B,OAAO,GAAG,CAAC,CAAC,OAAO,GAAG,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;IAChE,CAAC;CACF;AA9LD,gDA8LC"}
|
|
@@ -1,11 +1,23 @@
|
|
|
1
|
+
import LinkedApi from '@linkedapi/node';
|
|
2
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import type { TLinkedApiToolResult } from './types/linked-api-tool-result.type.js';
|
|
1
4
|
import { AdminTool } from './utils/admin-tool.js';
|
|
2
|
-
|
|
3
|
-
|
|
5
|
+
interface TRegisteredLinkedApiTool {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
getTool(): Tool;
|
|
8
|
+
validate(args: unknown): unknown;
|
|
9
|
+
execute(options: {
|
|
10
|
+
linkedapi: LinkedApi;
|
|
11
|
+
args: never;
|
|
12
|
+
mcpClient: string;
|
|
13
|
+
}): Promise<TLinkedApiToolResult<unknown>>;
|
|
14
|
+
}
|
|
4
15
|
export declare class LinkedApiTools {
|
|
5
|
-
readonly tools: ReadonlyArray<
|
|
16
|
+
readonly tools: ReadonlyArray<TRegisteredLinkedApiTool>;
|
|
6
17
|
readonly adminTools: ReadonlyArray<AdminTool<unknown, unknown>>;
|
|
7
|
-
constructor(
|
|
8
|
-
toolByName(name: string):
|
|
18
|
+
constructor();
|
|
19
|
+
toolByName(name: string): TRegisteredLinkedApiTool | undefined;
|
|
9
20
|
adminToolByName(name: string): AdminTool<unknown, unknown> | undefined;
|
|
10
21
|
}
|
|
22
|
+
export {};
|
|
11
23
|
//# sourceMappingURL=linked-api-tools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linked-api-tools.d.ts","sourceRoot":"","sources":["../src/linked-api-tools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"linked-api-tools.d.ts","sourceRoot":"","sources":["../src/linked-api-tools.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAuC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,UAAU,wBAAwB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,OAAO,IAAI,IAAI,CAAC;IAChB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;IACjC,OAAO,CAAC,OAAO,EAAE;QACf,SAAS,EAAE,SAAS,CAAC;QACrB,IAAI,EAAE,KAAK,CAAC;QACZ,SAAS,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;CAC5C;AAED,qBAAa,cAAc;IACzB,SAAgB,KAAK,EAAE,aAAa,CAAC,wBAAwB,CAAC,CAAC;IAC/D,SAAgB,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;;IAkDhE,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,wBAAwB,GAAG,SAAS;IAI9D,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,SAAS;CAG9E"}
|
package/dist/linked-api-tools.js
CHANGED
|
@@ -41,38 +41,38 @@ const withdraw_connection_request_js_1 = require("./tools/withdraw-connection-re
|
|
|
41
41
|
class LinkedApiTools {
|
|
42
42
|
tools;
|
|
43
43
|
adminTools;
|
|
44
|
-
constructor(
|
|
44
|
+
constructor() {
|
|
45
45
|
this.tools = [
|
|
46
46
|
// Standard tools
|
|
47
|
-
new send_message_js_1.SendMessageTool(
|
|
48
|
-
new get_conversation_js_1.GetConversationTool(
|
|
49
|
-
new check_connection_status_js_1.CheckConnectionStatusTool(
|
|
50
|
-
new retrieve_connections_js_1.RetrieveConnectionsTool(
|
|
51
|
-
new send_connection_request_js_1.SendConnectionRequestTool(
|
|
52
|
-
new withdraw_connection_request_js_1.WithdrawConnectionRequestTool(
|
|
53
|
-
new retrieve_pending_requests_js_1.RetrievePendingRequestsTool(
|
|
54
|
-
new remove_connection_js_1.RemoveConnectionTool(
|
|
55
|
-
new search_companies_js_1.SearchCompaniesTool(
|
|
56
|
-
new search_people_js_1.SearchPeopleTool(
|
|
57
|
-
new fetch_company_js_1.FetchCompanyTool(
|
|
58
|
-
new fetch_person_js_1.FetchPersonTool(
|
|
59
|
-
new fetch_post_js_1.FetchPostTool(
|
|
60
|
-
new react_to_post_js_1.ReactToPostTool(
|
|
61
|
-
new comment_on_post_js_1.CommentOnPostTool(
|
|
62
|
-
new create_post_js_1.CreatePostTool(
|
|
63
|
-
new retrieve_ssi_js_1.RetrieveSSITool(
|
|
64
|
-
new retrieve_performance_js_1.RetrievePerformanceTool(
|
|
47
|
+
new send_message_js_1.SendMessageTool(),
|
|
48
|
+
new get_conversation_js_1.GetConversationTool(),
|
|
49
|
+
new check_connection_status_js_1.CheckConnectionStatusTool(),
|
|
50
|
+
new retrieve_connections_js_1.RetrieveConnectionsTool(),
|
|
51
|
+
new send_connection_request_js_1.SendConnectionRequestTool(),
|
|
52
|
+
new withdraw_connection_request_js_1.WithdrawConnectionRequestTool(),
|
|
53
|
+
new retrieve_pending_requests_js_1.RetrievePendingRequestsTool(),
|
|
54
|
+
new remove_connection_js_1.RemoveConnectionTool(),
|
|
55
|
+
new search_companies_js_1.SearchCompaniesTool(),
|
|
56
|
+
new search_people_js_1.SearchPeopleTool(),
|
|
57
|
+
new fetch_company_js_1.FetchCompanyTool(),
|
|
58
|
+
new fetch_person_js_1.FetchPersonTool(),
|
|
59
|
+
new fetch_post_js_1.FetchPostTool(),
|
|
60
|
+
new react_to_post_js_1.ReactToPostTool(),
|
|
61
|
+
new comment_on_post_js_1.CommentOnPostTool(),
|
|
62
|
+
new create_post_js_1.CreatePostTool(),
|
|
63
|
+
new retrieve_ssi_js_1.RetrieveSSITool(),
|
|
64
|
+
new retrieve_performance_js_1.RetrievePerformanceTool(),
|
|
65
65
|
// Sales Navigator tools
|
|
66
|
-
new nv_send_message_js_1.NvSendMessageTool(
|
|
67
|
-
new nv_get_conversation_js_1.NvGetConversationTool(
|
|
68
|
-
new nv_search_companies_js_1.NvSearchCompaniesTool(
|
|
69
|
-
new nv_search_people_js_1.NvSearchPeopleTool(
|
|
70
|
-
new nv_fetch_company_js_1.NvFetchCompanyTool(
|
|
71
|
-
new nv_fetch_person_js_1.NvFetchPersonTool(
|
|
66
|
+
new nv_send_message_js_1.NvSendMessageTool(),
|
|
67
|
+
new nv_get_conversation_js_1.NvGetConversationTool(),
|
|
68
|
+
new nv_search_companies_js_1.NvSearchCompaniesTool(),
|
|
69
|
+
new nv_search_people_js_1.NvSearchPeopleTool(),
|
|
70
|
+
new nv_fetch_company_js_1.NvFetchCompanyTool(),
|
|
71
|
+
new nv_fetch_person_js_1.NvFetchPersonTool(),
|
|
72
72
|
// Other tools
|
|
73
|
-
new execute_custom_workflow_js_1.ExecuteCustomWorkflowTool(
|
|
74
|
-
new get_workflow_result_js_1.GetWorkflowResultTool(
|
|
75
|
-
new get_api_usage_stats_js_1.GetApiUsageTool(
|
|
73
|
+
new execute_custom_workflow_js_1.ExecuteCustomWorkflowTool(),
|
|
74
|
+
new get_workflow_result_js_1.GetWorkflowResultTool(),
|
|
75
|
+
new get_api_usage_stats_js_1.GetApiUsageTool(),
|
|
76
76
|
];
|
|
77
77
|
this.adminTools = [
|
|
78
78
|
new admin_get_subscription_status_js_1.AdminGetSubscriptionStatusTool(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linked-api-tools.js","sourceRoot":"","sources":["../src/linked-api-tools.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"linked-api-tools.js","sourceRoot":"","sources":["../src/linked-api-tools.ts"],"names":[],"mappings":";;;AAGA,+EAA2E;AAC3E,qFAAiF;AACjF,yEAAqE;AACrE,iFAA4E;AAC5E,mEAA+D;AAC/D,+FAA0F;AAC1F,iFAA6E;AAC7E,yEAAqE;AACrE,qEAAiE;AACjE,mEAA+D;AAC/D,mFAA+E;AAC/E,mEAA+D;AAC/D,2DAAwD;AACxD,mFAA+E;AAC/E,+DAA4D;AAC5D,6DAA0D;AAC1D,yDAAsD;AACtD,2EAAiE;AACjE,qEAAkE;AAClE,2EAAuE;AACvE,qEAAiE;AACjE,mEAA+D;AAC/D,2EAAuE;AACvE,2EAAuE;AACvE,qEAAiE;AACjE,mEAA+D;AAC/D,+DAA2D;AAC3D,uEAAoE;AACpE,6EAA0E;AAC1E,uFAAmF;AACnF,6EAA0E;AAC1E,6DAA0D;AAC1D,qEAAkE;AAClE,+DAA4D;AAC5D,mFAA+E;AAC/E,6DAA0D;AAC1D,2FAAuF;AAevF,MAAa,cAAc;IACT,KAAK,CAA0C;IAC/C,UAAU,CAA6C;IAEvE;QACE,IAAI,CAAC,KAAK,GAAG;YACX,iBAAiB;YACjB,IAAI,iCAAe,EAAE;YACrB,IAAI,yCAAmB,EAAE;YACzB,IAAI,sDAAyB,EAAE;YAC/B,IAAI,iDAAuB,EAAE;YAC7B,IAAI,sDAAyB,EAAE;YAC/B,IAAI,8DAA6B,EAAE;YACnC,IAAI,0DAA2B,EAAE;YACjC,IAAI,2CAAoB,EAAE;YAC1B,IAAI,yCAAmB,EAAE;YACzB,IAAI,mCAAgB,EAAE;YACtB,IAAI,mCAAgB,EAAE;YACtB,IAAI,iCAAe,EAAE;YACrB,IAAI,6BAAa,EAAE;YACnB,IAAI,kCAAe,EAAE;YACrB,IAAI,sCAAiB,EAAE;YACvB,IAAI,+BAAc,EAAE;YACpB,IAAI,iCAAe,EAAE;YACrB,IAAI,iDAAuB,EAAE;YAC7B,wBAAwB;YACxB,IAAI,sCAAiB,EAAE;YACvB,IAAI,8CAAqB,EAAE;YAC3B,IAAI,8CAAqB,EAAE;YAC3B,IAAI,wCAAkB,EAAE;YACxB,IAAI,wCAAkB,EAAE;YACxB,IAAI,sCAAiB,EAAE;YACvB,cAAc;YACd,IAAI,sDAAyB,EAAE;YAC/B,IAAI,8CAAqB,EAAE;YAC3B,IAAI,wCAAe,EAAE;SACtB,CAAC;QAEF,IAAI,CAAC,UAAU,GAAG;YAChB,IAAI,iEAA8B,EAAE;YACpC,IAAI,sCAAiB,EAAE;YACvB,IAAI,sCAAiB,EAAE;YACvB,IAAI,4CAAoB,EAAE;YAC1B,IAAI,kDAAuB,EAAE;YAC7B,IAAI,wDAA0B,EAAE;YAChC,IAAI,oDAAwB,EAAE;YAC9B,IAAI,mDAAuB,EAAE;YAC7B,IAAI,wCAAkB,EAAE;YACxB,IAAI,4CAAoB,EAAE;SAC3B,CAAC;IACJ,CAAC;IAEM,UAAU,CAAC,IAAY;QAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACvD,CAAC;IAEM,eAAe,CAAC,IAAY;QACjC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAC5D,CAAC;CACF;AA3DD,wCA2DC"}
|
package/dist/prompts/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const systemPrompt = "You are a Linked API MCP server that provides access to LinkedIn data and actions.\n\nCRITICAL PERFORMANCE RULE: Only set optional parameters (retrieveExperience, retrieveEmployees, retrievePosts, etc.) to true if the user explicitly requests that specific data. Each additional parameter significantly increases execution time.\n\nDEFAULT BEHAVIOR: Always use basic requests first. For example:\n- fetch_person(personUrl) - gets name, title, company (fast)\n- Only add retrieveExperience: true if user asks for work history\n- Only add retrievePosts: true if user asks for posts/content\n\nDON'T enable multiple optional flags unless the user specifically requests all that data.\n\nAUTHENTICATION ERROR HANDLING\n\nWHEN YOU GET AN AUTHENTICATION ERROR:\nThe MCP client must provide valid authentication tokens to use Linked API services.\n\nREQUIRED TOKENS (have to be provided in headers in each request):\n- linked-api-token: Your Linked API access token from linkedapi.io\n- identification-token: Your identification token from linkedapi.io\n\nTOKEN SETUP:\n1. Visit https://linkedapi.io to get tokens\n2. Set headers with every request\n3. Keep tokens secure and never share them in logs or error messages\n\nBACKGROUND WORKFLOW HANDLING\n\nLINKEDIN WORKFLOWS RUN IN THE BACKGROUND:\n- Linked API operations often take 3-5 minutes or longer\n- To keep the MCP client responsive, workflows continue in the background\n- This is INTENTIONAL DESIGN for better user experience\n- You receive periodic updates about workflow progress\n- Simply continue listening for updates using get_workflow_result\n\nWHEN A WORKFLOW IS RUNNING IN BACKGROUND:\n1. You'll receive a status message with: workflowId and operationName\n2. Use get_workflow_result(workflowId, operationName) to continue listening for updates\n3. Keep listening until you get the final results\n4. This is normal workflow operation - the task is actively running\n\nEXAMPLE BACKGROUND WORKFLOW MESSAGE:\n{\n \"message\": \"Workflow is running in the background. Continue listening for updates.\",\n \"workflowId\": \"account-12345-abcde\",\n \"operationName\": \"searchCompanies\"\n}\n\nRESPONSE: \"Great! The search is running in the background. Let me continue listening for updates.\"\n\nALWAYS EXPLAIN TO USERS:\n- The workflow is actively running in the background\n- You're continuing to listen for updates\n- This ensures responsive interaction while processing\n- This is how Linked API provides optimal user experience\n\nCLIENT ACTION WHEN YOU SEE A BACKGROUND WORKFLOW MESSAGE:\n- Immediately call the get_workflow_result tool with the provided workflowId and operationName\n- Keep calling get_workflow_result until the final result is returned\n- Do NOT retry the original tool; the workflow is already running\n- Treat this as normal, successful behavior (not an error)\n\nREQUIRED PARAMETERS FOR get_workflow_result:\n- workflowId: The exact value from the background message\n- operationName: The exact value from the background message (required for correct type restoration)\n\nGENERIC MCP CALL EXAMPLE:\n{\n \"name\": \"get_workflow_result\",\n \"arguments\": {\n \"workflowId\": \"account-12345-abcde\",\n \"operationName\": \"searchCompanies\"\n }\n}\n\nRemember: Background workflows = Active processing with responsive updates!";
|
|
1
|
+
export declare const systemPrompt = "You are a Linked API MCP server that provides access to LinkedIn data and actions.\n\nCRITICAL PERFORMANCE RULE: Only set optional parameters (retrieveExperience, retrieveEmployees, retrievePosts, etc.) to true if the user explicitly requests that specific data. Each additional parameter significantly increases execution time.\n\nDEFAULT BEHAVIOR: Always use basic requests first. For example:\n- fetch_person(personUrl) - gets name, title, company (fast)\n- Only add retrieveExperience: true if user asks for work history\n- Only add retrievePosts: true if user asks for posts/content\n\nDON'T enable multiple optional flags unless the user specifically requests all that data.\n\nAUTHENTICATION ERROR HANDLING\n\nWHEN YOU GET AN AUTHENTICATION ERROR:\nThe MCP client must provide valid authentication tokens to use Linked API services.\n\nREQUIRED TOKENS (have to be provided in headers in each request):\n- linked-api-token: Your Linked API access token from linkedapi.io\n- identification-token: Your identification token from linkedapi.io\n\nTOKEN SETUP:\n1. Visit https://linkedapi.io to get tokens\n2. Set headers with every request\n3. Keep tokens secure and never share them in logs or error messages\n\nBACKGROUND WORKFLOW HANDLING\n\nLINKEDIN WORKFLOWS RUN IN THE BACKGROUND:\n- Linked API operations often take 3-5 minutes or longer\n- To keep the MCP client responsive, workflows continue in the background\n- This is INTENTIONAL DESIGN for better user experience\n- You receive periodic updates about workflow progress\n- Simply continue listening for updates using get_workflow_result\n\nWHEN A WORKFLOW IS RUNNING IN BACKGROUND:\n1. You'll receive a status message with: workflowId, status, message, and operationName\n2. Use get_workflow_result(workflowId, operationName) to continue listening for updates\n3. Keep listening until you get the final results\n4. This is normal workflow operation - the task is actively running\n\nEXAMPLE BACKGROUND WORKFLOW MESSAGE:\n{\n \"message\": \"Workflow is running in the background. Continue listening for updates.\",\n \"status\": \"running\",\n \"workflowId\": \"account-12345-abcde\",\n \"operationName\": \"searchCompanies\"\n}\n\nRESPONSE: \"Great! The search is running in the background. Let me continue listening for updates.\"\n\nALWAYS EXPLAIN TO USERS:\n- The workflow is actively running in the background\n- You're continuing to listen for updates\n- This ensures responsive interaction while processing\n- This is how Linked API provides optimal user experience\n\nCLIENT ACTION WHEN YOU SEE A BACKGROUND WORKFLOW MESSAGE:\n- Immediately call the get_workflow_result tool with the provided workflowId and operationName\n- Keep calling get_workflow_result until the final result is returned\n- Do NOT retry the original tool; the workflow is already running\n- Treat this as normal, successful behavior (not an error)\n\nREQUIRED PARAMETERS FOR get_workflow_result:\n- workflowId: The exact value from the background message\n- operationName: The exact value from the background message (required for correct type restoration)\n\nGENERIC MCP CALL EXAMPLE:\n{\n \"name\": \"get_workflow_result\",\n \"arguments\": {\n \"workflowId\": \"account-12345-abcde\",\n \"operationName\": \"searchCompanies\"\n }\n}\n\nRemember: Background workflows = Active processing with responsive updates!";
|
|
2
2
|
export declare const parameterUsageGuidelines = "Parameter Usage Guidelines:\n\nFAST:\n- Basic person/company info (no optional flags)\n- Simple searches\n- Send messages, connection requests\n\nSLOW:\n- retrievePosts, retrieveComments, retrieveReactions \n- retrieveEmployees, retrieveDMs\n- Complex searches\n\nVERY SLOW:\n- Multiple optional flags together\n- Large employee lists\n- Extensive post history\n\nOnly enable what the user explicitly requests.";
|
|
3
|
-
export declare const backgroundWorkflowPrompt = "LINKED API BACKGROUND WORKFLOWS GUIDE\n\nIMPORTANT: Background workflows are NORMAL and OPTIMAL behavior!\n\nWHY WORKFLOWS RUN IN BACKGROUND:\n- Linked API operations are naturally slow (5+ minutes)\n- MCP client stays responsive by running workflows in background\n- This is INTENTIONAL DESIGN for better user experience\n- Your operation continues processing while you get updates\n\nWHAT TO DO WHEN WORKFLOW RUNS IN BACKGROUND:\n1. Look for workflowId and operationName in the status message\n2. Immediately call get_workflow_result(workflowId, operationName) to continue listening\n3. Repeat get_workflow_result until you get final results\n4. Do NOT re-run the original tool; the workflow is already executing\n5. Treat this as normal, successful operation (not an error)\n\nEXAMPLE BACKGROUND WORKFLOW MESSAGE:\n{\n \"message\": \"Workflow is running in the background. Continue listening for updates.\",\n \"workflowId\": \"account-12345-abcde\", \n \"operationName\": \"searchCompanies\"\n}\n\nCORRECT RESPONSE:\n\"Perfect! The search is running in the background. Let me continue listening by calling get_workflow_result with the provided parameters.\"\n\nGENERIC MCP CALL TO CONTINUE LISTENING:\n{\n \"name\": \"get_workflow_result\",\n \"arguments\": {\n \"workflowId\": \"account-12345-abcde\",\n \"operationName\": \"searchCompanies\"\n }\n}\n\nINCORRECT RESPONSE:\n\"Sorry, there was an error. The search failed.\"\n\nREMEMBER:\n\u2705 Background workflows = Active processing (operation is running)\n\u274C Background workflows \u2260 Errors (operation is not broken)\n\uD83D\uDD04 Always continue listening for workflow updates\n\u23F1\uFE0F Linked API uses background processing for optimal UX\n\nCOMMON MISTAKES TO AVOID:\n- Retrying the original tool instead of calling get_workflow_result\n- Omitting operationName (it is required)\n- Treating the background message as a failure instead of an active process";
|
|
3
|
+
export declare const backgroundWorkflowPrompt = "LINKED API BACKGROUND WORKFLOWS GUIDE\n\nIMPORTANT: Background workflows are NORMAL and OPTIMAL behavior!\n\nWHY WORKFLOWS RUN IN BACKGROUND:\n- Linked API operations are naturally slow (5+ minutes)\n- MCP client stays responsive by running workflows in background\n- This is INTENTIONAL DESIGN for better user experience\n- Your operation continues processing while you get updates\n\nWHAT TO DO WHEN WORKFLOW RUNS IN BACKGROUND:\n1. Look for workflowId and operationName in the status message\n2. Immediately call get_workflow_result(workflowId, operationName) to continue listening\n3. Repeat get_workflow_result until you get final results\n4. Do NOT re-run the original tool; the workflow is already executing\n5. Treat this as normal, successful operation (not an error)\n\nEXAMPLE BACKGROUND WORKFLOW MESSAGE:\n{\n \"message\": \"Workflow is running in the background. Continue listening for updates.\",\n \"status\": \"running\",\n \"workflowId\": \"account-12345-abcde\", \n \"operationName\": \"searchCompanies\"\n}\n\nCORRECT RESPONSE:\n\"Perfect! The search is running in the background. Let me continue listening by calling get_workflow_result with the provided parameters.\"\n\nGENERIC MCP CALL TO CONTINUE LISTENING:\n{\n \"name\": \"get_workflow_result\",\n \"arguments\": {\n \"workflowId\": \"account-12345-abcde\",\n \"operationName\": \"searchCompanies\"\n }\n}\n\nINCORRECT RESPONSE:\n\"Sorry, there was an error. The search failed.\"\n\nREMEMBER:\n\u2705 Background workflows = Active processing (operation is running)\n\u274C Background workflows \u2260 Errors (operation is not broken)\n\uD83D\uDD04 Always continue listening for workflow updates\n\u23F1\uFE0F Linked API uses background processing for optimal UX\n\nCOMMON MISTAKES TO AVOID:\n- Retrying the original tool instead of calling get_workflow_result\n- Omitting operationName (it is required)\n- Treating the background message as a failure instead of an active process";
|
|
4
4
|
export declare const authenticationPrompt = "AUTHENTICATION REQUIREMENTS:\n- MCP clients must provide valid authentication tokens to use Linked API services\n- linked-api-token: Main Linked API access token from linkedapi.io\n- identification-token: Account identification token from linkedapi.io\n\nTOKEN SETUP:\n1. Visit https://linkedapi.io to get tokens\n2. Set headers with every request in MCP client configuration\n3. Keep tokens secure and never share them in logs or error messages\n\nMore information: https://linkedapi.io/mcp/installation/";
|
|
5
5
|
export declare const availablePrompts: {
|
|
6
6
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,gzGA2EmD,CAAC;AAE7E,eAAO,MAAM,wBAAwB,gaAiBU,CAAC;AAEhD,eAAO,MAAM,wBAAwB,q7DAiDuC,CAAC;AAE7E,eAAO,MAAM,oBAAoB,8fAUwB,CAAC;AAE1D,eAAO,MAAM,gBAAgB;;;GAiB5B,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAarD"}
|
package/dist/prompts/index.js
CHANGED
|
@@ -37,7 +37,7 @@ LINKEDIN WORKFLOWS RUN IN THE BACKGROUND:
|
|
|
37
37
|
- Simply continue listening for updates using get_workflow_result
|
|
38
38
|
|
|
39
39
|
WHEN A WORKFLOW IS RUNNING IN BACKGROUND:
|
|
40
|
-
1. You'll receive a status message with: workflowId and operationName
|
|
40
|
+
1. You'll receive a status message with: workflowId, status, message, and operationName
|
|
41
41
|
2. Use get_workflow_result(workflowId, operationName) to continue listening for updates
|
|
42
42
|
3. Keep listening until you get the final results
|
|
43
43
|
4. This is normal workflow operation - the task is actively running
|
|
@@ -45,6 +45,7 @@ WHEN A WORKFLOW IS RUNNING IN BACKGROUND:
|
|
|
45
45
|
EXAMPLE BACKGROUND WORKFLOW MESSAGE:
|
|
46
46
|
{
|
|
47
47
|
"message": "Workflow is running in the background. Continue listening for updates.",
|
|
48
|
+
"status": "running",
|
|
48
49
|
"workflowId": "account-12345-abcde",
|
|
49
50
|
"operationName": "searchCompanies"
|
|
50
51
|
}
|
|
@@ -115,6 +116,7 @@ WHAT TO DO WHEN WORKFLOW RUNS IN BACKGROUND:
|
|
|
115
116
|
EXAMPLE BACKGROUND WORKFLOW MESSAGE:
|
|
116
117
|
{
|
|
117
118
|
"message": "Workflow is running in the background. Continue listening for updates.",
|
|
119
|
+
"status": "running",
|
|
118
120
|
"workflowId": "account-12345-abcde",
|
|
119
121
|
"operationName": "searchCompanies"
|
|
120
122
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":";;;AAk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AE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,qBAAa,iBAAkB,SAAQ,aAAa,CAAC,oBAAoB,EAAE,OAAO,CAAC;IACjF,SAAyB,IAAI,qBAAqB;IAClD,SAAyB,aAAa,kBAAgC;IACtE,mBAA4B,MAAM;;;;sBAI/B;IAEa,OAAO,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"comment-on-post.d.ts","sourceRoot":"","sources":["../../src/tools/comment-on-post.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,qBAAa,iBAAkB,SAAQ,aAAa,CAAC,oBAAoB,EAAE,OAAO,CAAC;IACjF,SAAyB,IAAI,qBAAqB;IAClD,SAAyB,aAAa,kBAAgC;IACtE,mBAA4B,MAAM;;;;sBAI/B;IAEa,OAAO,IAAI,IAAI;CA2BhC"}
|
|
@@ -15,7 +15,7 @@ class CommentOnPostTool extends linked_api_tool_js_1.OperationTool {
|
|
|
15
15
|
getTool() {
|
|
16
16
|
return {
|
|
17
17
|
name: this.name,
|
|
18
|
-
description: 'Allows you to leave a comment on a post (st.commentOnPost action).',
|
|
18
|
+
description: 'Allows you to leave a comment on a post (st.commentOnPost action). If this workflow is still running, do not retry this tool; retrying can post duplicate comments.',
|
|
19
19
|
inputSchema: {
|
|
20
20
|
type: 'object',
|
|
21
21
|
properties: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comment-on-post.js","sourceRoot":"","sources":["../../src/tools/comment-on-post.ts"],"names":[],"mappings":";;;AAAA,0CAAuE;AAEvE,6BAAwB;AAExB,oEAA4D;AAE5D,MAAa,iBA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wBACd,WAAW,EACT,mJAAmJ;qBACtJ;iBACF;gBACD,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC;aAC9B;SACF,CAAC;IACJ,CAAC;CACF;AApCD,8CAoCC"}
|
|
@@ -22,7 +22,7 @@ class CreatePostTool extends linked_api_tool_js_1.OperationTool {
|
|
|
22
22
|
getTool() {
|
|
23
23
|
return {
|
|
24
24
|
name: this.name,
|
|
25
|
-
description: 'Creates a new LinkedIn post with optional media attachments (st.createPost action).',
|
|
25
|
+
description: 'Creates a new LinkedIn post with optional media attachments (st.createPost action). If this workflow is still running, do not retry this tool; retrying can create duplicate posts.',
|
|
26
26
|
inputSchema: {
|
|
27
27
|
type: 'object',
|
|
28
28
|
properties: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-post.js","sourceRoot":"","sources":["../../src/tools/create-post.ts"],"names":[],"mappings":";;;AAAA,0CAAoE;AAEpE,6BAAwB;AAExB,oEAA4D;AAE5D,MAAa,cAAe,SAAQ,kCAAyC;IAClD,IAAI,GAAG,aAAa,CAAC;IACrB,aAAa,GAAG,qBAAc,CAAC,UAAU,CAAC;IACvC,MAAM,GAAG,OAAC,CAAC,MAAM,CAAC;QAC5C,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;QACjC,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QACjC,WAAW,EAAE,OAAC;aACX,KAAK,CACJ,OAAC,CAAC,MAAM,CAAC;YACP,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;YACf,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;YAC5C,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAC5B,CAAC,CACH;aACA,GAAG,CAAC,CAAC,CAAC;aACN,QAA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AW,EACT,+HAA+H;wBACjI,KAAK,EAAE;4BACL,IAAI,EAAE,QAAQ;4BACd,UAAU,EAAE;gCACV,GAAG,EAAE;oCACH,IAAI,EAAE,QAAQ;oCACd,WAAW,EAAE,4CAA4C;iCAC1D;gCACD,IAAI,EAAE;oCACJ,IAAI,EAAE,QAAQ;oCACd,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC;oCACpC,WAAW,EAAE,2BAA2B;iCACzC;gCACD,IAAI,EAAE;oCACJ,IAAI,EAAE,QAAQ;oCACd,WAAW,EAAE,yDAAyD;iCACvE;6BACF;4BACD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC;yBAC1B;qBACF;iBACF;gBACD,QAAQ,EAAE,CAAC,MAAM,CAAC;aACnB;SACF,CAAC;IACJ,CAAC;CACF;AAhED,wCAgEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute-custom-workflow.d.ts","sourceRoot":"","sources":["../../src/tools/execute-custom-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,qBAAa,yBAA0B,SAAQ,aAAa,CAC1D,mBAAmB,EACnB,mBAAmB,CACpB;IACC,SAAyB,IAAI,6BAA6B;IAC1D,SAAyB,aAAa,mBAAiC;IACvE,mBAA4B,MAAM;;sBAE/B;IAEa,OAAO,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"execute-custom-workflow.d.ts","sourceRoot":"","sources":["../../src/tools/execute-custom-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,qBAAa,yBAA0B,SAAQ,aAAa,CAC1D,mBAAmB,EACnB,mBAAmB,CACpB;IACC,SAAyB,IAAI,6BAA6B;IAC1D,SAAyB,aAAa,mBAAiC;IACvE,mBAA4B,MAAM;;sBAE/B;IAEa,OAAO,IAAI,IAAI;CAYhC"}
|