comment_on_post
Add comments to LinkedIn posts using a specific URL and custom text, enabling engagement and interaction directly through the Linked API MCP server.
Instructions
Allows you to leave a comment on a post (st.commentOnPost action).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| postUrl | Yes | The LinkedIn post URL to comment on (e.g., 'https://www.linkedin.com/posts/username_activity-id') | |
| text | Yes | Comment text, must be up to 1000 characters. |
Implementation Reference
- src/tools/comment-on-post.ts:7-36 (handler)Defines the CommentOnPostTool class implementing the 'comment_on_post' MCP tool. Sets the tool name, LinkedIn operation name, Zod input schema for validation, and returns the full Tool specification including inputSchema and description.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'], }, }; } }
- src/linked-api-tools.ts:34-64 (registration)Registers the CommentOnPostTool instance (line 50) within the LinkedApiTools class's tools array, making it available as part of the MCP tools suite.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 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), ];
- src/utils/linked-api-tool.ts:36-58 (handler)Provides the core execution logic for OperationTool-based tools like comment_on_post. The execute method resolves the specific LinkedIn API operation by operationName ('commentOnPost') and invokes it with input parameters and progress reporting.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, }); } }
- src/linked-api-tools.ts:2-2 (registration)Imports the CommentOnPostTool for use in LinkedApiTools.import { CommentOnPostTool } from './tools/comment-on-post.js';
- src/tools/comment-on-post.ts:10-13 (schema)Zod schema defining input parameters: postUrl (string) and text (non-empty string). Used for validation in execute.protected override readonly schema = z.object({ postUrl: z.string(), text: z.string().min(1), });