Skip to main content
Glama

get_thread_comments

Retrieve comments from a specific AniList thread by providing the thread ID, page number, and comments per page. Simplify accessing thread discussions in a structured format.

Instructions

Get comments for a specific thread

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe AniList thread ID
pageNoThe page number
perPageNoHow many comments per page

Implementation Reference

  • Handler function that calls anilist.thread.getComments(id, page, perPage) to fetch comments and returns them as JSON text block, or error response.
    async ({ id, page = 1, perPage = 25 }) => {
      try {
        const comments = await anilist.thread.getComments(id, page, perPage);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(comments, null, 2),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [{ type: "text", text: `Error: ${error.message}` }],
          isError: true,
        };
      }
    },
  • Input schema using Zod: id (number, required), page (number, optional, default 1), perPage (number, optional, default 25).
    {
      id: z.number().describe("The AniList thread ID"),
      page: z.number().optional().default(1).describe("The page number"),
      perPage: z
        .number()
        .optional()
        .default(25)
        .describe("How many comments per page"),
    },
  • tools/thread.ts:86-121 (registration)
    Registers the 'get_thread_comments' tool on the MCP server, providing name, description, input schema, metadata hints, and handler function.
    server.tool(
      "get_thread_comments",
      "Get comments for a specific thread",
      {
        id: z.number().describe("The AniList thread ID"),
        page: z.number().optional().default(1).describe("The page number"),
        perPage: z
          .number()
          .optional()
          .default(25)
          .describe("How many comments per page"),
      },
      {
        title: "Get AniList Thread Comments",
        readOnlyHint: true,
        openWorldHint: true,
      },
      async ({ id, page = 1, perPage = 25 }) => {
        try {
          const comments = await anilist.thread.getComments(id, page, perPage);
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(comments, null, 2),
              },
            ],
          };
        } catch (error: any) {
          return {
            content: [{ type: "text", text: `Error: ${error.message}` }],
            isError: true,
          };
        }
      },
    );
  • tools/index.ts:38-38 (registration)
    Calls registerThreadTools within registerAllTools to register all thread-related tools, including get_thread_comments.
    registerThreadTools(server, anilist, config);

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/yuna0x0/anilist-mcp'

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