Skip to main content
Glama

create_comment

Add comments to Qiita articles using Markdown formatting. Specify the article ID and comment body to contribute to developer discussions.

Instructions

指定された記事にコメントを作成します

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemIdYes記事ID
bodyYesコメントの本文(Markdown形式)

Implementation Reference

  • The handler definition for the 'create_comment' tool, including Zod input schema validation and execution logic that delegates to the QiitaApiClient.
    create_comment: { schema: z.object({ itemId: z.string(), body: z.string(), }), execute: async ({ itemId, body }, client) => client.createComment(itemId, body), },
  • The MCP Tool definition for 'create_comment', providing the JSON input schema, description, and metadata used for tool listing.
    { name: 'create_comment', description: '指定された記事にコメントを作成します', inputSchema: { type: 'object', properties: { itemId: { type: 'string', description: '記事ID', }, body: { type: 'string', description: 'コメントの本文(Markdown形式)', }, }, required: ['itemId', 'body'], }, },
  • The QiitaApiClient method implementing the core logic to create a comment via HTTP POST to the Qiita API.
    async createComment(itemId: string, body: string) { this.assertAuthenticated(); const response = await this.client.post(`/items/${itemId}/comments`, { body }); return response.data; }
  • src/index.ts:30-65 (registration)
    The generic tool execution handler registration in the MCP server, which dispatches to specific tool handlers based on name, including 'create_comment' via toolHandlers[name].
    server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; const accessToken = process.env.QIITA_ACCESS_TOKEN; const qiita = new QiitaApiClient(accessToken); const handler = toolHandlers[name]; try { if (!handler) { throw new Error(`未知のツール: ${name}`); } const parsedArgs = handler.schema.parse(args ?? {}); const result = await handler.execute(parsedArgs, qiita); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } catch (error: any) { const message = error?.message ?? String(error); return { content: [ { type: 'text', text: `エラーが発生しました: ${message}`, }, ], isError: true, }; } });

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/Selenium39/mcp-server-qiita'

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