Skip to main content
Glama

get_user_anime_list

Retrieve a user's anime list using their username or ID. Integrate with the AniList MCP server to access and manage anime-related data efficiently.

Instructions

Get a user's anime list

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userYesUsername or user ID

Implementation Reference

  • The handler function for the 'get_user_anime_list' tool. It fetches the anime list for the given user (ID or username) using the AniList client, returns the JSON-stringified list as text content, or an error message if failed.
    async ({ user }) => {
      try {
        const list = await anilist.lists.anime(user);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(list, null, 2),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [{ type: "text", text: `Error: ${error.message}` }],
          isError: true,
        };
      }
    },
  • Input schema for the tool, defining the 'user' parameter as either a number (user ID) or string (username).
    {
      user: z.union([z.number(), z.string()]).describe("Username or user ID"),
    },
  • tools/lists.ts:54-83 (registration)
    Registration of the 'get_user_anime_list' tool on the MCP server, specifying name, description, input schema, metadata hints, and the handler function.
    server.tool(
      "get_user_anime_list",
      "Get a user's anime list",
      {
        user: z.union([z.number(), z.string()]).describe("Username or user ID"),
      },
      {
        title: "Get User Anime List",
        readOnlyHint: true,
        openWorldHint: true,
      },
      async ({ user }) => {
        try {
          const list = await anilist.lists.anime(user);
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(list, 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