From 352a7ac06b310d4ee96b280f8bdfad531639014c Mon Sep 17 00:00:00 2001 From: vprudnikoff Date: Wed, 4 Nov 2026 11:44:24 +0000 Subject: [PATCH] Accept customSearchUrl in people search; unfollow by default on withdraw retrieve_profile_viewers tells the agent to pass an anonymous viewer's searchUrl to search_people as customSearchUrl, but neither search_people nor nv_search_people declared that field, so zod dropped it and the API rejected the call for lacking a term. Both tools now accept customSearchUrl and, like search_posts, require term or customSearchUrl. withdraw_connection_request documented unfollow as defaulting to true but sent nothing, and Core defaults to false; the tool now sends true unless told otherwise, as the CLI does. --- package-lock.json | 4 +- package.json | 2 +- src/tools/nv-search-people.ts | 51 ++++++++++++++---------- src/tools/search-people.ts | 49 ++++++++++++++--------- src/tools/withdraw-connection-request.ts | 2 +- 5 files changed, 65 insertions(+), 43 deletions(-) diff --git a/package-lock.json b/package-lock.json index aab4301..2d76a6c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@linkedapi/mcp", - "version": "2.3.22", + "version": "2.3.23", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@linkedapi/mcp", - "version": "2.3.22", + "version": "2.3.23", "license": "MIT", "dependencies": { "@linkedapi/node": "^2.3.21", diff --git a/package.json b/package.json index cb98ef3..fed12a2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@linkedapi/mcp", - "version": "2.3.22", + "version": "2.3.23", "description": "MCP server that lets AI assistants control LinkedIn accounts and retrieve real-time data.", "main": "dist/index.js", "bin": { diff --git a/src/tools/nv-search-people.ts b/src/tools/nv-search-people.ts index 6a49893..f9f759a 100644 --- a/src/tools/nv-search-people.ts +++ b/src/tools/nv-search-people.ts @@ -7,36 +7,42 @@ import { OperationTool } from '../utils/linked-api-tool.js'; export class NvSearchPeopleTool extends OperationTool { public override readonly name = 'nv_search_people'; public override readonly operationName = OPERATION_NAME.nvSearchPeople; - protected override readonly schema = z.object({ - term: z.string().optional(), - limit: z.number().min(1).max(2500).optional(), - filter: z - .object({ - firstName: z.string().optional(), - lastName: z.string().optional(), - position: z.string().optional(), - locations: z.array(z.string()).optional(), - industries: z.array(z.string()).optional(), - currentCompanies: z.array(z.string()).optional(), - previousCompanies: z.array(z.string()).optional(), - schools: z.array(z.string()).optional(), - yearsOfExperiences: z.array(z.string()).optional(), - connectionDegrees: z.array(z.enum(['1st', '2nd', '3rd+', 'groupMembers'])).optional(), - }) - .optional(), - }); + protected override readonly schema = z + .object({ + term: z.string().optional(), + limit: z.number().min(1).max(2500).optional(), + filter: z + .object({ + firstName: z.string().optional(), + lastName: z.string().optional(), + position: z.string().optional(), + locations: z.array(z.string()).optional(), + industries: z.array(z.string()).optional(), + currentCompanies: z.array(z.string()).optional(), + previousCompanies: z.array(z.string()).optional(), + schools: z.array(z.string()).optional(), + yearsOfExperiences: z.array(z.string()).optional(), + connectionDegrees: z.array(z.enum(['1st', '2nd', '3rd+', 'groupMembers'])).optional(), + }) + .optional(), + customSearchUrl: z.string().optional(), + }) + .refine(({ term, customSearchUrl }) => Boolean(term) || Boolean(customSearchUrl), { + message: 'Either term or customSearchUrl must be provided.', + }); public override getTool(): Tool { return { name: this.name, description: - 'Allows you to search people in Sales Navigator applying various filtering criteria. (nv.searchPeople action). Every person in the result carries urn — their permanent LinkedIn member URN (urn:li:member:), or null when LinkedIn does not expose it. The same person carries the same urn in standard interface results, so it can be used to match Sales Navigator results against them. Every person also carries viewerState.connectionDegree — your connection degree to them (1st, 2nd, 3rd+), or null when LinkedIn shows none.', + 'Allows you to search people in Sales Navigator applying various filtering criteria. (nv.searchPeople action). Either term or customSearchUrl must be provided. Every person in the result carries urn — their permanent LinkedIn member URN (urn:li:member:), or null when LinkedIn does not expose it. The same person carries the same urn in standard interface results, so it can be used to match Sales Navigator results against them. Every person also carries viewerState.connectionDegree — your connection degree to them (1st, 2nd, 3rd+), or null when LinkedIn shows none.', inputSchema: { type: 'object', properties: { term: { type: 'string', - description: 'Optional. Keyword or phrase to search.', + description: + 'Optional. Keyword or phrase to search. Required unless customSearchUrl is specified.', }, limit: { type: 'number', @@ -110,6 +116,11 @@ export class NvSearchPeopleTool extends OperationTool { public override readonly name = 'search_people'; public override readonly operationName = OPERATION_NAME.searchPeople; - protected override readonly schema = z.object({ - term: z.string().optional(), - limit: z.number().min(1).max(1000).optional(), - filter: z - .object({ - firstName: z.string().optional(), - lastName: z.string().optional(), - position: z.string().optional(), - locations: z.array(z.string()).optional(), - industries: z.array(z.string()).optional(), - currentCompanies: z.array(z.string()).optional(), - previousCompanies: z.array(z.string()).optional(), - schools: z.array(z.string()).optional(), - connectionDegrees: z.array(z.enum(['1st', '2nd', '3rd+'])).optional(), - }) - .optional(), - }); + protected override readonly schema = z + .object({ + term: z.string().optional(), + limit: z.number().min(1).max(1000).optional(), + filter: z + .object({ + firstName: z.string().optional(), + lastName: z.string().optional(), + position: z.string().optional(), + locations: z.array(z.string()).optional(), + industries: z.array(z.string()).optional(), + currentCompanies: z.array(z.string()).optional(), + previousCompanies: z.array(z.string()).optional(), + schools: z.array(z.string()).optional(), + connectionDegrees: z.array(z.enum(['1st', '2nd', '3rd+'])).optional(), + }) + .optional(), + customSearchUrl: z.string().optional(), + }) + .refine(({ term, customSearchUrl }) => Boolean(term) || Boolean(customSearchUrl), { + message: 'Either term or customSearchUrl must be provided.', + }); public override getTool(): Tool { return { name: this.name, description: - 'Allows you to search people applying various filtering criteria (st.searchPeople action). Every person in the result carries urn — their permanent LinkedIn member URN (urn:li:member:), or null when LinkedIn does not expose it. Every person also carries viewerState.connectionDegree — your connection degree to them (1st, 2nd, 3rd+), or null when LinkedIn shows none.', + 'Allows you to search people applying various filtering criteria (st.searchPeople action). Either term or customSearchUrl must be provided. Every person in the result carries urn — their permanent LinkedIn member URN (urn:li:member:), or null when LinkedIn does not expose it. Every person also carries viewerState.connectionDegree — your connection degree to them (1st, 2nd, 3rd+), or null when LinkedIn shows none.', inputSchema: { type: 'object', properties: { term: { type: 'string', - description: 'Optional. Keyword or phrase to search.', + description: + 'Optional. Keyword or phrase to search. Required unless customSearchUrl is specified.', }, limit: { type: 'number', @@ -100,6 +106,11 @@ export class SearchPeopleTool extends OperationTool