Skip to main content
Glama
Linked-API
by Linked-API

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());
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves data but doesn't describe what data is returned, potential rate limits, authentication requirements, error conditions, or whether it's a read-only operation. The mention of 'st.openPost action' is vague and adds little practical context for an AI agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the core purpose upfront. The parenthetical reference to 'st.openPost action' could be considered extraneous but doesn't significantly detract from clarity. It's appropriately sized for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 5 parameters, nested objects, no annotations, and no output schema, the description is insufficient. It doesn't explain what data structure is returned, how to interpret results, or any behavioral constraints. The agent must rely entirely on the input schema for parameter understanding with no guidance on output or operational context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, thoroughly documenting all 5 parameters and their nested objects. The description adds minimal value beyond the schema, only implying that comments and reactions are optional features. It doesn't provide additional context about parameter interactions or usage examples beyond what's already in the schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Open a LinkedIn post and retrieve its data') and resource ('LinkedIn post'), with optional extensions for comments and reactions. It distinguishes from siblings like 'comment_on_post' or 'react_to_post' by focusing on retrieval rather than interaction. However, it doesn't explicitly differentiate from other fetch tools like 'fetch_company' or 'fetch_person' beyond the resource type.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions optional comments and reactions but doesn't explain when to enable them, nor does it reference sibling tools like 'get_conversation' or 'retrieve_performance' that might serve similar data retrieval purposes. No exclusions or prerequisites are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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