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
| Name | Required | Description | Default |
|---|---|---|---|
| user | Yes | Username or user ID |
Implementation Reference
- tools/lists.ts:65-82 (handler)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, }; } },
- tools/lists.ts:57-59 (schema)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, }; } }, );