Skip to main content
Glama

write_comment

Add comments to BAND posts using band and post identifiers with specified content to engage with group discussions.

Instructions

Write a comment to BAND post.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
band_keyYesband identifier
bodyYescomment content
post_keyYespost identifier

Implementation Reference

  • The main handler function that executes the write_comment tool by calling the BAND API to create a comment and returning the formatted response.
    export async function handleToolCall(band_key: string, post_key: string, body: string) {
        const commentData = await bandApiClient.post<WriteCommentResponse>(
            '/v2/band/post/comment/create',
            { band_key, post_key, body }
        );
        return {
            content: [{
                type: "text",
                text: JSON.stringify(commentData, null, 2)
            }]
        };
    }
  • Defines the ToolDefinition including inputSchema (band_key, post_key, body) and outputSchema (result_code, result_data with comment_key) for the write_comment tool.
    export const ToolDefinition : Tool = {
        name: "write_comment",
        description: "Write a comment to BAND post.",
        inputSchema: {
            type: "object",
            properties: {
                band_key: {
                    type: "string",
                    title: "Band Key",
                    description: "band identifier"
                },
                post_key: {
                    type: "string",
                    title: "Post Key",
                    description: "post identifier"
                },
                body: {
                    type: "string",
                    title: "Body",
                    description: "comment content"
                }
            },
            required: ["band_key", "post_key", "body"]
        },
        outputSchema: {
            type: "object",
            properties: {
                result_code: {
                    type: "number",
                    description: "Result code"
                },
                result_data: {
                    type: "object",
                    description: "Result data",
                    properties: {
                        comment_key: {
                            type: "string",
                            description: "created comment identifier"
                        }
                    }
                }
            },
            required: ["result_code", "result_data"]
        }
    };
  • src/tools.ts:67-72 (registration)
    Registers the dispatching of 'write_comment' tool calls to the specific handleToolCall function in the main tools handler.
    case "write_comment":
      return writeComment.handleToolCall(
        a.band_key as string,
        a.post_key as string,
        a.body as string
      );
  • src/tools.ts:15-28 (registration)
    Registers the ToolDefinition of write_comment in the array of available BAND tools.
    export const bandTools: Tool[] = [
      profile.ToolDefinition,
      bands.ToolDefinition,
      posts.ToolDefinition,
      post.ToolDefinition,
      comments.ToolDefinition,
      permissions.ToolDefinition,
      albums.ToolDefinition,
      photos.ToolDefinition,
      writeComment.ToolDefinition,
      writePost.ToolDefinition,
      removePost.ToolDefinition,
      removeComment.ToolDefinition,
    ];
  • Helper module that re-exports ToolDefinition and handleToolCall from tool.ts for easy import in the main tools file.
    import {ToolDefinition, handleToolCall} from "./tool.js";
    
    const writeComment = {ToolDefinition, handleToolCall}
    
    export default writeComment;

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/kanghouchao/band-mcp-server'

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