Skip to main content
Glama

favourite_manga

Manage your manga favorites on AniList by adding or removing titles using their unique ID. Requires login to update your preferences.

Instructions

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

Input Schema

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

Implementation Reference

  • The handler function that implements the core logic of the 'favourite_manga' tool. It authenticates the user via requireAuth, toggles the favourite status of the specified manga ID using the AniList API, and returns a textual response indicating success or failure.
    async ({ id }) => {
      try {
        const auth = requireAuth(config.anilistToken);
        if (!auth.isAuthorized) {
          return auth.errorResponse;
        }
    
        const result = await anilist.media.favouriteManga(id);
        return {
          content: [
            {
              type: "text",
              text: result
                ? `Successfully added manga with ID ${id} to favourites.`
                : `Manga with ID ${id} was removed from favourites or operation failed.`,
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [{ type: "text", text: `Error: ${error.message}` }],
          isError: true,
        };
      }
    },
  • The input schema for the 'favourite_manga' tool, defining a required numeric 'id' parameter for the AniList manga ID.
    {
      id: z
        .number()
        .describe("The AniList ID of the manga to favourite/unfavourite"),
    },
  • tools/media.ts:110-150 (registration)
    The registration of the 'favourite_manga' tool with the MCP server, including name, description, input schema, tool hints, and handler function.
    server.tool(
      "favourite_manga",
      "[Requires Login] Favourite or unfavourite a manga by its ID",
      {
        id: z
          .number()
          .describe("The AniList ID of the manga to favourite/unfavourite"),
      },
      {
        title: "Favourite/Unfavourite Manga",
        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.media.favouriteManga(id);
          return {
            content: [
              {
                type: "text",
                text: result
                  ? `Successfully added manga with ID ${id} to favourites.`
                  : `Manga 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