Skip to main content
Glama

get_posts

Retrieve posts from a specified band group in BAND, enabling users to access group content and manage post data through the Band API.

Instructions

Get posts from a specific band in BAND.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
afterNofor paging
band_keyYesband identifier
limitNonumber of posts to load. min: 1, max: 100, default: 20
localeNoRegion and languageja_JP

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
result_codeYesResult code
result_dataYesResult data

Implementation Reference

  • The core handler function that implements the logic for the 'get_posts' tool. It resolves the band key, constructs API parameters, fetches posts from the BAND API endpoint '/v2/band/posts', and returns the formatted response.
    export async function handleToolCall(
      band_key: string | undefined,
      locale?: string,
      after?: string,
      limit?: number,
      url?: string
    ) {
      let resolvedBandKey = band_key ? band_key.trim() : undefined;
      if ((!resolvedBandKey || resolvedBandKey.length === 0) && url) {
        const parsed = parseBandUrl(url);
        resolvedBandKey = parsed.bandKey;
      }
    
      if (!resolvedBandKey) {
        throw new Error("Either band_key or a valid BAND url must be provided.");
      }
    
      const resolvedLocale = locale && locale.trim().length > 0 ? locale : "ja_JP";
    
      const params: Record<string, unknown> = {
        band_key: resolvedBandKey,
        locale: resolvedLocale,
      };
      if (after) (params as Record<string, unknown>).after = after;
      if (limit) (params as Record<string, unknown>).limit = limit;
    
      const postsData = await bandApiClient.get<PostsResponse>(
        "/v2/band/posts",
        params
      );
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(postsData, null, 2),
          },
        ],
      };
    }
  • Defines the ToolDefinition for 'get_posts', including name, description, detailed inputSchema (with parameters like band_key or url, pagination), and outputSchema (result_code, paging, list of posts with photos, authors, etc.).
    export const ToolDefinition: Tool = {
      name: "get_posts",
      description: "Get posts from a specific band in BAND.",
      inputSchema: {
        type: "object",
        properties: {
          band_key: {
            type: "string",
            title: "Band Key",
            description: "band identifier",
          },
          locale: {
            type: "string",
            default: "ja_JP",
            title: "Locale",
            description: "Region and language",
          },
          after: {
            type: "string",
            title: "After",
            description: "for paging",
          },
          limit: {
            type: "number",
            title: "Limit",
            default: 20,
            description: "number of posts to load. min: 1, max: 100, default: 20",
          },
          url: {
            type: "string",
            title: "Band URL",
            description:
              "Full BAND URL to the band page (e.g., https://band.us/band/{band_key}).",
          },
        },
        anyOf: [
          { required: ["band_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",
                properties: {
                  previous_params: {
                    type: ["object", "null"],
                    description: "Previous page parameters",
                  },
                  next_params: {
                    type: ["object", "null"],
                    description: "Next page parameters",
                  },
                },
              },
              items: {
                type: "array",
                description: "List of posts",
                items: {
                  type: "object",
                  properties: {
                    content: {
                      type: "string",
                      description: "post content",
                    },
                    post_key: {
                      type: "string",
                      description: "post identifier",
                    },
                    created_at: {
                      type: "number",
                      description: "created time",
                    },
                    photos: {
                      type: "array",
                      description: "post photos",
                      items: {
                        type: "object",
                        properties: {
                          width: {
                            type: "number",
                            description: "photo width",
                          },
                          height: {
                            type: "number",
                            description: "photo height",
                          },
                          photo_key: {
                            type: "string",
                            description: "photo identifier",
                          },
                          photo_album_key: {
                            type: ["string", "null"],
                            description: "photo album identifier",
                          },
                          author: {
                            type: "object",
                            description: "photo author",
                            properties: {
                              name: {
                                type: "string",
                                description: "author name",
                              },
                              description: {
                                type: "string",
                                description: "author description",
                              },
                              profile_image_url: {
                                type: "string",
                                description: "author profile image url",
                              },
                            },
                          },
                          url: {
                            type: "string",
                            description: "photo url",
                          },
                          comment_count: {
                            type: "number",
                            description: "photo comment count",
                          },
                          emotion_count: {
                            type: "number",
                            description: "photo emotion count",
                          },
                          created_at: {
                            type: "number",
                            description: "photo created time",
                          },
                          is_video_thumbnail: {
                            type: "boolean",
                            description: "is video thumbnail",
                          },
                        },
                      },
                    },
                    comment_count: {
                      type: "number",
                      description: "post comment count",
                    },
                    author: {
                      type: "object",
                      description: "post 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:38-45 (registration)
    Registers the dispatch for 'get_posts' tool in the central handleToolCall switch statement, routing calls to posts.handleToolCall with argument parsing.
    case "get_posts":
      return posts.handleToolCall(
        a.band_key as string | undefined,
        a.locale as string | undefined,
        a.after as string | undefined,
        a.limit as number | undefined,
        a.url as string | undefined
      );
  • src/tools.ts:15-28 (registration)
    Registers the 'get_posts' ToolDefinition (via posts.ToolDefinition) in the array of all 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,
    ];
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states a read operation ('Get posts') but lacks details on permissions, rate limits, pagination behavior (beyond the 'after' parameter), or what the output contains. This is a significant gap for a tool with no annotation coverage.

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's front-loaded with the core purpose, making it appropriately sized and structured for quick understanding.

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, the description doesn't need to explain return values. However, with no annotations and a read operation that involves parameters like pagination and locale, the description is minimal and lacks context on behavioral aspects (e.g., permissions, data scope). It's adequate but has clear gaps in completeness.

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, after, limit, locale) with descriptions. The description adds no additional meaning beyond implying a band context, which is redundant with the schema. Baseline 3 is appropriate when 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 posts') and the resource ('from a specific band in BAND'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'get_post' (singular) or 'get_comments', which might retrieve related data, so it's not fully specific to sibling context.

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. It doesn't mention sibling tools like 'get_post' (for a single post) or 'get_comments' (for comments on posts), leaving the agent without explicit usage context or exclusions.

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