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

comment_on_post

Add comments to LinkedIn posts by providing the post URL and comment text, enabling engagement through the Linked API MCP server.

Instructions

Allows you to leave a comment on a post (st.commentOnPost action).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
postUrlYesThe LinkedIn post URL to comment on (e.g., 'https://www.linkedin.com/posts/username_activity-id')
textYesComment text, must be up to 1000 characters.

Implementation Reference

  • Defines the CommentOnPostTool class, the core implementation of the 'comment_on_post' tool. Sets the tool name, LinkedIn API operation name, Zod input schema, and returns the MCP Tool specification including detailed input schema.
    export class CommentOnPostTool extends OperationTool<TCommentOnPostParams, unknown> {
      public override readonly name = 'comment_on_post';
      public override readonly operationName = OPERATION_NAME.commentOnPost;
      protected override readonly schema = z.object({
        postUrl: z.string(),
        text: z.string().min(1),
      });
    
      public override getTool(): Tool {
        return {
          name: this.name,
          description: 'Allows you to leave a comment on a post (st.commentOnPost action).',
          inputSchema: {
            type: 'object',
            properties: {
              postUrl: {
                type: 'string',
                description:
                  "The LinkedIn post URL to comment on (e.g., 'https://www.linkedin.com/posts/username_activity-id')",
              },
              text: {
                type: 'string',
                description: 'Comment text, must be up to 1000 characters.',
              },
            },
            required: ['postUrl', 'text'],
          },
        };
      }
    }
  • Registers the CommentOnPostTool by instantiating it with progressCallback and including it in the readonly tools array of LinkedApiTools class.
    this.tools = [
      // Standard tools
      new SendMessageTool(progressCallback),
      new GetConversationTool(progressCallback),
      new CheckConnectionStatusTool(progressCallback),
      new RetrieveConnectionsTool(progressCallback),
      new SendConnectionRequestTool(progressCallback),
      new WithdrawConnectionRequestTool(progressCallback),
      new RetrievePendingRequestsTool(progressCallback),
      new RemoveConnectionTool(progressCallback),
      new SearchCompaniesTool(progressCallback),
      new SearchPeopleTool(progressCallback),
      new FetchCompanyTool(progressCallback),
      new FetchPersonTool(progressCallback),
      new FetchPostTool(progressCallback),
      new ReactToPostTool(progressCallback),
      new CommentOnPostTool(progressCallback),
      new CreatePostTool(progressCallback),
      new RetrieveSSITool(progressCallback),
      new RetrievePerformanceTool(progressCallback),
      // Sales Navigator tools
      new NvSendMessageTool(progressCallback),
      new NvGetConversationTool(progressCallback),
      new NvSearchCompaniesTool(progressCallback),
      new NvSearchPeopleTool(progressCallback),
      new NvFetchCompanyTool(progressCallback),
      new NvFetchPersonTool(progressCallback),
      // Other tools
      new ExecuteCustomWorkflowTool(progressCallback),
      new GetWorkflowResultTool(progressCallback),
      new GetApiUsageTool(progressCallback),
    ];
  • The execute method in the OperationTool base class (extended by CommentOnPostTool) implements the core handler logic: finds the API operation by operationName ('commentOnPost') and executes it with progress tracking using executeWithProgress.
    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,
      });
    }
  • OperationTool abstract base class providing the shared execution logic for operation-based tools like comment_on_post.
    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,
        });
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It mentions the action ('leave a comment') which implies a write/mutation operation, but doesn't disclose critical traits like authentication requirements, rate limits, whether comments are editable/deletable, or what happens on success/failure. The description adds little beyond the basic action.

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 gets straight to the point without unnecessary words. However, the parenthetical reference to 'st.commentOnPost action' adds minor clutter without clear value to an AI agent. Overall it's appropriately brief for a simple tool.

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 mutation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't address what the tool returns, error conditions, or important behavioral aspects like whether comments are publicly visible or require moderation. The 100% schema coverage helps with parameters, but overall context for safe/effective use is lacking.

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?

Schema description coverage is 100%, so the schema fully documents both parameters (postUrl format, text length limit). The description adds no additional parameter context beyond what's in the schema, maintaining the baseline score. It doesn't explain parameter relationships or provide usage examples.

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 ('leave a comment') and target resource ('on a post'), making the purpose immediately understandable. It distinguishes from siblings like 'react_to_post' or 'create_post' by specifying commenting rather than reacting or creating. However, it doesn't mention the LinkedIn platform context (implied by the schema but not explicit in description).

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 like 'react_to_post' or 'send_message' for engagement, nor does it mention prerequisites (e.g., needing access to the post). It simply states what the tool does without context about appropriate scenarios or limitations.

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