Skip to main content
Glama

get_character

Retrieve detailed information about a specific character using their AniList ID or name, accessible via the AniList MCP server.

Instructions

Get information about a character by their AniList ID or name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe AniList ID of the character

Implementation Reference

  • The handler function for the 'get_character' tool. It takes an ID or name, fetches the character data from AniList, and returns it as a formatted JSON string, with error handling.
      async ({ id }) => {
        try {
          const character = await anilist.people.character(id);
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(character, null, 2),
              },
            ],
          };
        } catch (error: any) {
          return {
            content: [{ type: "text", text: `Error: ${error.message}` }],
            isError: true,
          };
        }
      },
    );
  • Input schema for the 'get_character' tool using Zod, accepting either a numeric ID or string name for the character.
    {
      id: z
        .union([z.number(), z.string()])
        .describe("The AniList ID of the character"),
    },
  • tools/people.ts:14-44 (registration)
    Registration of the 'get_character' MCP tool within the registerPeopleTools function, including name, description, input schema, hints, and handler.
      "get_character",
      "Get information about a character by their AniList ID or name",
      {
        id: z
          .union([z.number(), z.string()])
          .describe("The AniList ID of the character"),
      },
      {
        title: "Get Character Info",
        readOnlyHint: true,
        openWorldHint: true,
      },
      async ({ id }) => {
        try {
          const character = await anilist.people.character(id);
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(character, null, 2),
              },
            ],
          };
        } catch (error: any) {
          return {
            content: [{ type: "text", text: `Error: ${error.message}` }],
            isError: true,
          };
        }
      },
    );

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