get_connections
Retrieve your 1st-degree LinkedIn connections. Use the optional limit parameter to control the number of connections returned.
Instructions
List the user's 1st-degree connections (requires r_network permission).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of connections to retrieve (default: 50). |
Implementation Reference
- src/linkedin-client.ts:99-103 (handler)The getConnections method on LinkedInClient makes an API GET request to /connections?q=viewer&start=0&count=<limit> to fetch the user's 1st-degree connections.
async getConnections(limit: number = 50) { // Note: To use the /connections API, specific permissions are needed (r_network). const response = await this.client.get("/connections?q=viewer&start=0&count=" + limit); return response.data; } - src/tools/network/index.ts:20-32 (handler)handleNetworkTool function: the 'get_connections' case calls client.getConnections(args?.limit) and returns the JSON-stringified result.
export async function handleNetworkTool(name: string, args: any, client: LinkedInClient) { switch (name) { case "get_connections": { const result = await client.getConnections(args?.limit); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } - src/tools/network/index.ts:4-17 (schema)Schema definition (input validation) for get_connections tool: accepts optional 'limit' number parameter (default: 50).
export const networkTools = [ { name: "get_connections", description: "List the user's 1st-degree connections (requires r_network permission).", inputSchema: { type: "object", properties: { limit: { type: "number", description: "Maximum number of connections to retrieve (default: 50).", }, }, }, }, - src/index.ts:47-55 (registration)Registration via ListToolsRequestSchema handler: networkTools (including get_connections) are spread into the list of available tools.
server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ ...profileTools, ...contentTools, ...networkTools, ...organizationTools, ], }; - src/index.ts:72-74 (registration)Registration via CallToolRequestSchema handler: when tool name matches a network tool, handleNetworkTool is dispatched.
if (networkTools.some((t) => t.name === name)) { return await handleNetworkTool(name, args, linkedinClient); }