Skip to main content
Glama

add_comment

Submit comments to Emlog blog articles, including the commenter’s name, email, website, and reply context, for enhanced engagement and discussion.

Instructions

Add a comment to an article

Input Schema

NameRequiredDescriptionDefault
commailNoEmail of the commenter
commentYesThe comment content
comnameYesName of the commenter
comurlNoWebsite URL of the commenter
gidYesThe ID of the article to comment on
pidNoParent comment ID for replies

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "commail": { "description": "Email of the commenter", "type": "string" }, "comment": { "description": "The comment content", "type": "string" }, "comname": { "description": "Name of the commenter", "type": "string" }, "comurl": { "description": "Website URL of the commenter", "type": "string" }, "gid": { "description": "The ID of the article to comment on", "type": "number" }, "pid": { "description": "Parent comment ID for replies", "type": "number" } }, "required": [ "gid", "comname", "comment" ], "type": "object" }

Implementation Reference

  • The MCP tool handler function for 'add_comment' that validates input, calls the EmlogClient.addComment method, and returns success or error response.
    async ({ gid, comname, comment, commail, comurl, pid }) => { try { await emlogClient.addComment({ gid, comname, comment, commail, comurl, pid }); return { content: [{ type: "text", text: `Successfully added comment to article ${gid} by ${comname}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } }
  • Zod input schema defining parameters for the add_comment tool: article ID, commenter name, comment text, optional email, URL, and parent comment ID.
    inputSchema: { gid: z.number().describe("The ID of the article to comment on"), comname: z.string().describe("Name of the commenter"), comment: z.string().describe("The comment content"), commail: z.string().optional().describe("Email of the commenter"), comurl: z.string().optional().describe("Website URL of the commenter"), pid: z.number().optional().describe("Parent comment ID for replies") }
  • src/index.ts:389-429 (registration)
    Registration of the 'add_comment' tool using McpServer.registerTool, including title, description, input schema, and handler function.
    server.registerTool( "add_comment", { title: "Add Comment", description: "Add a comment to an article", inputSchema: { gid: z.number().describe("The ID of the article to comment on"), comname: z.string().describe("Name of the commenter"), comment: z.string().describe("The comment content"), commail: z.string().optional().describe("Email of the commenter"), comurl: z.string().optional().describe("Website URL of the commenter"), pid: z.number().optional().describe("Parent comment ID for replies") } }, async ({ gid, comname, comment, commail, comurl, pid }) => { try { await emlogClient.addComment({ gid, comname, comment, commail, comurl, pid }); return { content: [{ type: "text", text: `Successfully added comment to article ${gid} by ${comname}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );
  • EmlogClient helper method that performs the actual HTTP POST to add a comment via the Emlog API endpoint.
    async addComment(comment: { gid: number; comname: string; comment: string; commail?: string; comurl?: string; avatar?: string; imgcode?: string; pid?: number; }): Promise<{ cid: number }> { const formData = this.buildFormData({ ...comment, resp: 'json' }); const response = await this.api.post('/index.php?action=addcom', formData); return response.data.data; }

Other Tools

Related 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/eraincc/emlog-mcp'

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