Skip to main content
Glama

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, }); } }

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