Skip to main content
Glama
Jing-yilin

LinkedIn MCP Server

by Jing-yilin

get_post

Extract and clean LinkedIn post data from URLs, providing structured information in TOON format for analysis or storage.

Instructions

Get LinkedIn post details. Returns cleaned data in TOON format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesLinkedIn post URL (required)
save_dirNoDirectory to save cleaned JSON data

Implementation Reference

  • The handler function that implements the core logic for the 'get_post' tool: fetches post data from '/post' endpoint using the provided URL, cleans it with DataCleaners.cleanPost, formats and returns the response in MCP CallToolResult format.
    private async getPost(args: Record<string, any>): Promise<CallToolResult> { const data = await this.makeRequest('/post', { url: args.url }); const cleaned = DataCleaners.cleanPost(data.element); return this.formatResponse(cleaned, { saveDir: args.save_dir, toolName: 'get_post', }); }
  • The input schema definition for the 'get_post' tool, specifying the required 'url' parameter and optional 'save_dir'.
    name: 'get_post', description: 'Get LinkedIn post details. Returns cleaned data in TOON format.', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'LinkedIn post URL (required)' }, save_dir: { type: 'string', description: 'Directory to save cleaned JSON data' }, }, required: ['url'], }, } as Tool,
  • src/index.ts:528-558 (registration)
    The CallTool request handler registration, including the switch statement that dispatches 'get_post' calls to the getPost handler method.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => { try { const { name, arguments: args } = request.params; if (!args) throw new McpError(ErrorCode.InvalidParams, 'Missing arguments'); switch (name) { case 'get_profile': return await this.getProfile(args as Record<string, any>); case 'search_profiles': return await this.searchProfiles(args as Record<string, any>); case 'get_profile_posts': return await this.getProfilePosts(args as Record<string, any>); case 'get_profile_comments': return await this.getProfileComments(args as Record<string, any>); case 'get_profile_reactions': return await this.getProfileReactions(args as Record<string, any>); case 'get_company': return await this.getCompany(args as Record<string, any>); case 'search_companies': return await this.searchCompanies(args as Record<string, any>); case 'get_company_posts': return await this.getCompanyPosts(args as Record<string, any>); case 'get_job': return await this.getJob(args as Record<string, any>); case 'search_jobs': return await this.searchJobs(args as Record<string, any>); case 'get_post': return await this.getPost(args as Record<string, any>); case 'search_posts': return await this.searchPosts(args as Record<string, any>); case 'get_post_comments': return await this.getPostComments(args as Record<string, any>); case 'get_post_reactions': return await this.getPostReactions(args as Record<string, any>); case 'get_group': return await this.getGroup(args as Record<string, any>); case 'search_groups': return await this.searchGroups(args as Record<string, any>); case 'search_geo_id': return await this.searchGeoId(args as Record<string, any>); default: throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`); } } catch (error) { if (error instanceof McpError) throw error; const message = error instanceof Error ? error.message : 'Unknown error occurred'; throw new McpError(ErrorCode.InternalError, `HarvestAPI error: ${message}`); } });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Jing-yilin/linkedin-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server