Skip to main content
Glama

esa_create_comment

Add comments to esa articles using Markdown formatting to provide feedback, ask questions, or contribute to discussions on specific posts.

Instructions

Post a comment to an article

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
post_numberYesPost number to comment on
body_mdYesComment body (Markdown format)
userNoPoster's screen_name (only team owners can specify)

Implementation Reference

  • Handler logic for the 'esa_create_comment' tool within the CallToolRequest switch statement. Validates arguments and calls EsaClient.createComment.
    case "esa_create_comment": {
      const args = request.params.arguments as unknown as CreateCommentArgs;
      if (!args.post_number || !args.body_md) {
        throw new Error("post_number and body_md are required");
      }
      const response = await esaClient.createComment(
        args.post_number,
        args.body_md,
        args.user
      );
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }
  • Tool schema definition including name, description, and inputSchema for 'esa_create_comment'.
    const createCommentTool: Tool = {
      name: "esa_create_comment",
      description: "Post a comment to an article",
      inputSchema: {
        type: "object",
        properties: {
          post_number: {
            type: "number",
            description: "Post number to comment on",
          },
          body_md: {
            type: "string",
            description: "Comment body (Markdown format)",
          },
          user: {
            type: "string",
            description: "Poster's screen_name (only team owners can specify)",
          },
        },
        required: ["post_number", "body_md"],
      },
    };
  • index.ts:604-619 (registration)
    Registration of the 'esa_create_comment' tool (as createCommentTool) in the ListToolsRequest handler, making it available to clients.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      console.error("ListToolsRequest received");
      return {
        tools: [
          listPostsTool,
          getPostTool,
          createPostTool,
          updatePostTool,
          listCommentsTool,
          getCommentTool,
          createCommentTool,
          getMembersTool,
          getMemberTool,
        ],
      };
    });
  • EsaClient helper method that performs the actual HTTP POST request to create a comment on the esa API.
    async createComment(post_number: number, body_md: string, user?: string): Promise<any> {
      const url = `${this.baseUrl}/posts/${post_number}/comments`;
      const commentData: { body_md: string; user?: string } = { body_md };
      
      if (user) commentData.user = user;
    
      const response = await fetch(url, {
        method: "POST",
        headers: this.headers,
        body: JSON.stringify({ comment: commentData }),
      });
    
      return response.json();
    }
  • TypeScript interface defining the arguments for createComment, used for type casting in the tool handler.
    interface CreateCommentArgs {
      post_number: number;
      body_md: string;
      user?: string;
    }

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/kajirita2002/esa-mcp-server'

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