Skip to main content
Glama

favourite_character

Add or remove characters as favorites on AniList using their unique ID. Requires user login to manage your preferred anime characters quickly.

Instructions

[Requires Login] Favourite or unfavourite a character by its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe AniList ID of the character to favourite/unfavourite

Implementation Reference

  • The handler function for the 'favourite_character' tool. It authenticates using requireAuth, calls anilist.people.favouriteChar(id) to toggle the favourite status, and returns a success or error message.
      async ({ id }) => {
        try {
          const auth = requireAuth(config.anilistToken);
          if (!auth.isAuthorized) {
            return auth.errorResponse;
          }
    
          const result = await anilist.people.favouriteChar(id);
          return {
            content: [
              {
                type: "text",
                text: result
                  ? `Successfully added character with ID ${id} to favourites.`
                  : `Character with ID ${id} was removed from favourites or operation failed.`,
              },
            ],
          };
        } catch (error: any) {
          return {
            content: [{ type: "text", text: `Error: ${error.message}` }],
            isError: true,
          };
        }
      },
    );
  • Input schema for the 'favourite_character' tool, defining the 'id' parameter as a required number (AniList character ID).
    {
      id: z
        .number()
        .describe("The AniList ID of the character to favourite/unfavourite"),
    },
  • tools/people.ts:48-88 (registration)
    Registration of the 'favourite_character' MCP tool using server.tool(), including name, description, input schema, metadata hints, and handler function.
      "favourite_character",
      "[Requires Login] Favourite or unfavourite a character by its ID",
      {
        id: z
          .number()
          .describe("The AniList ID of the character to favourite/unfavourite"),
      },
      {
        title: "Favourite/Unfavourite Character",
        readOnlyHint: false,
        destructiveHint: true,
        idempotentHint: false,
        openWorldHint: true,
      },
      async ({ id }) => {
        try {
          const auth = requireAuth(config.anilistToken);
          if (!auth.isAuthorized) {
            return auth.errorResponse;
          }
    
          const result = await anilist.people.favouriteChar(id);
          return {
            content: [
              {
                type: "text",
                text: result
                  ? `Successfully added character with ID ${id} to favourites.`
                  : `Character with ID ${id} was removed from favourites or operation failed.`,
              },
            ],
          };
        } 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