get_activity
Retrieve a specific AniList activity by its unique ID using the anilist-mcp server. Input the activity ID to fetch detailed activity data directly from the AniList API.
Instructions
Get a specific AniList activity by its ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| activityID | Yes | The AniList activity ID |
Implementation Reference
- tools/activity.ts:65-82 (handler)The handler function for the 'get_activity' tool. It retrieves the specific AniList activity by ID using the anilist library and returns the JSON stringified result or an error message.async ({ activityID }) => { try { const activity = await anilist.activity.get(activityID); return { content: [ { type: "text", text: JSON.stringify(activity, null, 2), }, ], }; } catch (error: any) { return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true, }; } },
- tools/activity.ts:57-59 (schema)Input schema for the 'get_activity' tool, defining the required 'activityID' parameter as a number.{ activityID: z.number().describe("The AniList activity ID"), },
- tools/activity.ts:54-83 (registration)Registration of the 'get_activity' tool within the registerActivityTools function using McpServer.tool method, including name, description, input schema, metadata, and handler.server.tool( "get_activity", "Get a specific AniList activity by its ID", { activityID: z.number().describe("The AniList activity ID"), }, { title: "Get an AniList Activity", readOnlyHint: true, openWorldHint: true, }, async ({ activityID }) => { try { const activity = await anilist.activity.get(activityID); return { content: [ { type: "text", text: JSON.stringify(activity, null, 2), }, ], }; } catch (error: any) { return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true, }; } }, );