get_recommendations_for_media
Retrieve personalized AniList media recommendations by providing a media ID, with options to paginate and limit results for efficient browsing.
Instructions
Get AniList recommendations for a specific media
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mediaID | Yes | The AniList media ID | |
| page | No | Target a specific page number for recommendations | |
| perPage | No | Limit the page amount (max 25 per AniList limits) |
Implementation Reference
- tools/recommendation.ts:64-86 (handler)The handler function that executes the tool: fetches AniList recommendations for a given media ID using pagination, returns JSON stringified response or error.async ({ mediaID, page, perPage }) => { try { const recommendationList = await anilist.recommendation.getList( mediaID, page, perPage, ); return { content: [ { type: "text", text: JSON.stringify(recommendationList, null, 2), }, ], }; } catch (error: any) { return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true, }; } }, );
- tools/recommendation.ts:46-58 (schema)Input schema using Zod: requires mediaID, optional page (default 1) and perPage (default 25).{ mediaID: z.number().describe("The AniList media ID"), page: z .number() .optional() .default(1) .describe("Target a specific page number for recommendations"), perPage: z .number() .optional() .default(25) .describe("Limit the page amount (max 25 per AniList limits)"), },
- tools/recommendation.ts:43-86 (registration)MCP server tool registration including name, description, input schema, metadata, and inline handler.server.tool( "get_recommendations_for_media", "Get AniList recommendations for a specific media", { mediaID: z.number().describe("The AniList media ID"), page: z .number() .optional() .default(1) .describe("Target a specific page number for recommendations"), perPage: z .number() .optional() .default(25) .describe("Limit the page amount (max 25 per AniList limits)"), }, { title: "Get AniList Recommendations for Media", readOnlyHint: true, openWorldHint: true, }, async ({ mediaID, page, perPage }) => { try { const recommendationList = await anilist.recommendation.getList( mediaID, page, perPage, ); return { content: [ { type: "text", text: JSON.stringify(recommendationList, null, 2), }, ], }; } catch (error: any) { return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true, }; } }, );