Skip to main content
Glama

get_comments

Retrieve comments from a specific BAND post to view community discussions and responses, using the post identifier and band key.

Instructions

Get comments from a specific post in BAND.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
band_keyYesband identifier
post_keyYespost identifier
sortNosort order for comments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
result_codeYesResult code
result_dataYesResult data

Implementation Reference

  • The handler function that implements the core logic for the 'get_comments' tool: resolves band_key and post_key from inputs or URL, fetches comments from BAND API, optionally filters by comment_key, and returns JSON-formatted response.
    export async function handleToolCall(
      band_key: string | undefined,
      post_key: string | undefined,
      sort?: string,
      url?: string
    ) {
      let resolvedBandKey = band_key ? band_key.trim() : undefined;
      let resolvedPostKey = post_key ? post_key.trim() : undefined;
      let targetCommentKey: string | undefined;
    
      if (url) {
        const parsed = parseBandUrl(url);
        if (!resolvedBandKey) resolvedBandKey = parsed.bandKey;
        if (!resolvedPostKey) resolvedPostKey = parsed.postKey;
        targetCommentKey = parsed.commentKey;
      }
    
      if (!resolvedBandKey || !resolvedPostKey) {
        throw new Error(
          "band_key and post_key are required unless a valid BAND url is provided.",
        );
      }
    
      const params: Record<string, unknown> = { band_key: resolvedBandKey, post_key: resolvedPostKey };
      if (sort) params.sort = sort;
    
      const commentsData = await bandApiClient.get<CommentsResponse>(
        "/v2/band/post/comments",
        params
      );
      let payload = commentsData;
    
      if (targetCommentKey) {
        const matched = commentsData.items.filter(
          (item) => item.comment_key === targetCommentKey,
        );
    
        if (matched.length === 0) {
          throw new Error(
            `Comment ${targetCommentKey} was not found in the retrieved page. Try fetching the comments without filtering or adjust pagination.`,
          );
        }
    
        payload = {
          ...commentsData,
          items: matched,
        };
      }
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(payload, null, 2),
          },
        ],
      };
    }
  • The ToolDefinition object defining the name, description, inputSchema, and outputSchema for the 'get_comments' tool.
    export const ToolDefinition: Tool = {
      name: "get_comments",
      description: "Get comments from a specific post in BAND.",
      inputSchema: {
        type: "object",
        properties: {
          band_key: {
            type: "string",
            title: "Band Key",
            description: "band identifier",
          },
          post_key: {
            type: "string",
            title: "Post Key",
            description: "post identifier",
          },
          sort: {
            type: "string",
            title: "Sort",
            description: "sort order for comments",
          },
          url: {
            type: "string",
            title: "Comment URL",
            description:
              "Full BAND URL to the post or comment (e.g., https://band.us/band/{band_key}/post/{post_key}?commentId={comment_key}).",
          },
        },
        anyOf: [
          { required: ["band_key", "post_key"] },
          { required: ["url"] },
        ],
      },
      outputSchema: {
        type: "object",
        properties: {
          result_code: {
            type: "number",
            description: "Result code",
          },
          result_data: {
            type: "object",
            description: "Result data",
            properties: {
              paging: {
                type: "object",
                description: "Paging information",
              },
              items: {
                type: "array",
                description: "List of comments",
                items: {
                  type: "object",
                  properties: {
                    comment_key: {
                      type: "string",
                      description: "comment identifier",
                    },
                    content: {
                      type: "string",
                      description: "comment content",
                    },
                    created_at: {
                      type: "number",
                      description: "comment created time",
                    },
                    author: {
                      type: "object",
                      description: "comment author",
                      properties: {
                        name: {
                          type: "string",
                          description: "author name",
                        },
                        description: {
                          type: "string",
                          description: "author description",
                        },
                        profile_image_url: {
                          type: "string",
                          description: "author profile image url",
                        },
                      },
                    },
                  },
                },
              },
            },
          },
        },
        required: ["result_code", "result_data"],
      },
    };
  • src/tools.ts:15-28 (registration)
    Registration of the 'get_comments' tool (imported as comments.ToolDefinition) in the central bandTools array exported for MCP tool setup.
    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,
    ];
  • src/tools.ts:48-54 (registration)
    Switch case in the main handleToolCall dispatcher that routes calls to the 'get_comments' handler in the comments module.
    case "get_comments":
      return comments.handleToolCall(
        a.band_key as string | undefined,
        a.post_key as string | undefined,
        a.sort as string | undefined,
        a.url as string | undefined
      );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves comments but doesn't mention whether it's read-only, requires authentication, has rate limits, returns paginated results, or includes metadata. This is a significant gap for a tool with potential complexity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It front-loads the core purpose ('Get comments') and specifies the context ('from a specific post in BAND'), making it appropriately sized and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema (which covers return values), 100% schema coverage for inputs, and no annotations, the description is minimally adequate. However, it lacks behavioral context (e.g., read-only nature, error handling), which is needed for a tool interacting with a social platform like BAND.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters (band_key, post_key, sort). The description adds no additional meaning beyond implying a post context, which is already clear from the parameter names. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get comments') and the resource ('from a specific post in BAND'), distinguishing it from siblings like get_post or get_posts. However, it doesn't explicitly differentiate from write_comment or remove_comment in terms of read vs. write operations, which would require a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like get_post (which might include comments) or write_comment. It lacks explicit context, prerequisites, or exclusions, leaving the agent to infer usage based on the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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