withdraw_connection_request
Withdraw a pending LinkedIn connection request by providing the person's profile URL. Optionally unfollow them to stop seeing updates.
Instructions
Allows you to withdraw the connection request sent to a person (st.withdrawConnectionRequest action).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| personUrl | Yes | Public or hashed LinkedIn URL of the person you want to withdraw the connection request from. (e.g., 'https://www.linkedin.com/in/john-doe') | |
| unfollow | No | Optional. Boolean indicating whether you want to unfollow the person when withdrawing the request. The default value is true. |
Implementation Reference
- src/utils/linked-api-tool.ts:36-58 (handler)The OperationTool base class provides the actual execute() handler for withdraw_connection_request. It looks up the operation by name from the LinkedApi client and runs it via executeWithProgress.
export abstract class OperationTool<TParams, TResult> extends LinkedApiTool<TParams, TResult> { public abstract readonly operationName: TOperationName; public override execute({ linkedapi, args, workflowTimeout, progressToken, }: { linkedapi: LinkedApi; args: TParams; workflowTimeout: number; progressToken?: string | number; }): Promise<TMappedResponse<TResult>> { const operation = linkedapi.operations.find( (operation) => operation.operationName === this.operationName, )! as Operation<TParams, TResult>; return executeWithProgress(this.progressCallback, operation, workflowTimeout, { params: args, progressToken, }); } } - The WithdrawConnectionRequestTool class itself. It sets the tool name, operation name, and Zod schema, and provides the getTool() method returning the MCP Tool definition. It inherits execute() from OperationTool.
export class WithdrawConnectionRequestTool extends OperationTool< TWithdrawConnectionRequestParams, unknown > { public override readonly name = 'withdraw_connection_request'; public override readonly operationName = OPERATION_NAME.withdrawConnectionRequest; protected override readonly schema = z.object({ personUrl: z.string(), unfollow: z.boolean().optional(), }); public override getTool(): Tool { return { name: this.name, description: 'Allows you to withdraw the connection request sent to a person (st.withdrawConnectionRequest action).', inputSchema: { type: 'object', properties: { personUrl: { type: 'string', description: "Public or hashed LinkedIn URL of the person you want to withdraw the connection request from. (e.g., 'https://www.linkedin.com/in/john-doe')", }, unfollow: { type: 'boolean', description: 'Optional. Boolean indicating whether you want to unfollow the person when withdrawing the request. The default value is true.', }, }, required: ['personUrl'], }, }; } } - The Zod schema defining input validation for the tool. Requires 'personUrl' (string) and optionally 'unfollow' (boolean).
protected override readonly schema = z.object({ personUrl: z.string(), unfollow: z.boolean().optional(), }); - src/linked-api-tools.ts:54-54 (registration)Where WithdrawConnectionRequestTool is instantiated and registered in the tools array.
new WithdrawConnectionRequestTool(progressCallback), - The executeWithProgress helper used by OperationTool to run the operation with progress reporting and timeout handling.
export async function executeWithProgress<TParams, TResult>( progressCallback: (progress: LinkedApiProgressNotification) => void, operation: Operation<TParams, TResult>, workflowTimeout: number, { params, workflowId, progressToken, }: { params?: TParams; workflowId?: string; progressToken?: string | number } = {}, ): Promise<TMappedResponse<TResult>> { let progress = 0; progressCallback({ progressToken, progress, total: 100, message: `Starting workflow ${operation.operationName}...`, }); const interval = setInterval( () => { if (progress < 50) { progress += 5; } else if (progress < 98) { progress += 1; } progressCallback({ progressToken, progress, total: 100, message: `Executing workflow ${operation.operationName}...`, }); }, Math.max(workflowTimeout / 20, 10000), ); try { if (!workflowId) { workflowId = await operation.execute(params as TParams); } const result = await operation.result(workflowId, { timeout: workflowTimeout, }); clearInterval(interval); progressCallback({ progressToken, progress: 100, total: 100, message: `Workflow ${operation.operationName} completed successfully`, }); return result; } catch (error) { clearInterval(interval); if (error instanceof LinkedApiWorkflowTimeoutError) { throw generateTimeoutError(error); } throw error; } }