Skip to main content
Glama

fetch_post

Retrieve LinkedIn post data including content, with options to fetch comments and reactions for analysis.

Instructions

Open a LinkedIn post and retrieve its data, with optional comments and reactions. (st.openPost action).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
postUrlYesLinkedIn URL of the post. (e.g., 'https://www.linkedin.com/posts/username_activity-id')
retrieveCommentsNoOptional. When true, also retrieve comments for the post. Configure via commentsRetrievalConfig.
retrieveReactionsNoOptional. When true, also retrieve reactions for the post. Configure via reactionsRetrievalConfig.
commentsRetrievalConfigNoOptional. Applies only when retrieveComments is true. Controls comments retrieval (limit, replies, sort).
reactionsRetrievalConfigNoOptional. Applies only when retrieveReactions is true. Controls reactions retrieval (limit).

Implementation Reference

  • The FetchPostTool class implements the 'fetch_post' tool. It extends OperationTool, sets the tool name to 'fetch_post', maps to the specific LinkedIn API operation, defines the Zod input schema for validation, and provides the MCP Tool definition including JSON inputSchema and description.
    export class FetchPostTool extends OperationTool<TFetchPostParams, unknown> { public override readonly name = 'fetch_post'; public override readonly operationName = OPERATION_NAME.fetchPost; protected override readonly schema = z.object({ postUrl: z.string(), retrieveComments: z.boolean().optional(), retrieveReactions: z.boolean().optional(), commentsRetrievalConfig: z .object({ limit: z.number().min(1).max(500).optional(), replies: z.boolean().optional(), sort: z.enum(['mostRelevant', 'mostRecent']).optional(), }) .optional(), reactionsRetrievalConfig: z .object({ limit: z.number().min(1).max(1000).optional(), }) .optional(), }); public override getTool(): Tool { return { name: this.name, description: 'Open a LinkedIn post and retrieve its data, with optional comments and reactions. (st.openPost action).', inputSchema: { type: 'object', properties: { postUrl: { type: 'string', description: "LinkedIn URL of the post. (e.g., 'https://www.linkedin.com/posts/username_activity-id')", }, retrieveComments: { type: 'boolean', description: 'Optional. When true, also retrieve comments for the post. Configure via commentsRetrievalConfig.', }, retrieveReactions: { type: 'boolean', description: 'Optional. When true, also retrieve reactions for the post. Configure via reactionsRetrievalConfig.', }, commentsRetrievalConfig: { type: 'object', description: 'Optional. Applies only when retrieveComments is true. Controls comments retrieval (limit, replies, sort).', properties: { limit: { type: 'number', description: 'Optional. Max number of comments to retrieve. Defaults to 10, with a maximum value of 500.', }, replies: { type: 'boolean', description: 'Optional. When true, include replies to comments (threaded).', }, sort: { type: 'string', enum: ['mostRelevant', 'mostRecent'], description: "Optional. Sort order for comments. One of 'mostRelevant' or 'mostRecent'.", }, }, }, reactionsRetrievalConfig: { type: 'object', description: 'Optional. Applies only when retrieveReactions is true. Controls reactions retrieval (limit).', properties: { limit: { type: 'number', description: 'Optional. Max number of reactions to retrieve. Defaults to 10, with a maximum value of 1000.', }, }, }, }, required: ['postUrl'], }, }; } }
  • Zod schema for validating the input parameters of the fetch_post tool.
    protected override readonly schema = z.object({ postUrl: z.string(), retrieveComments: z.boolean().optional(), retrieveReactions: z.boolean().optional(), commentsRetrievalConfig: z .object({ limit: z.number().min(1).max(500).optional(), replies: z.boolean().optional(), sort: z.enum(['mostRelevant', 'mostRecent']).optional(), }) .optional(), reactionsRetrievalConfig: z .object({ limit: z.number().min(1).max(1000).optional(), }) .optional(), });
  • FetchPostTool is imported and instantiated as part of the LinkedApiTools collection, which aggregates all LinkedIn API tools.
    new FetchPersonTool(progressCallback), new FetchPostTool(progressCallback),
  • Base OperationTool class that provides the core execution logic for operation-based tools like fetch_post. It locates the corresponding LinkedIn API operation by name and executes it with progress tracking.
    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, }); } }
  • LinkedApiMCPServer exposes the tools from LinkedApiTools as MCP Tools via getTools(), effectively registering fetch_post for the MCP server.
    public getTools(): Tool[] { return this.tools.tools.map((tool) => tool.getTool()); }

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/Linked-API/linkedapi-mcp'

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