get_user_activity
Retrieve user activities from AniList by specifying the user ID, page number, and entries per page for streamlined activity tracking.
Instructions
Fetch activities from a user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | The page number to display | |
| perPage | No | How many entries to display on one page (max 25) | |
| user | Yes | The user's AniList ID |
Implementation Reference
- tools/activity.ts:107-128 (handler)The handler function that implements the core logic of the 'get_user_activity' tool by fetching activities for a given user using the AniList API and returning them as JSON or an error response.async ({ user, page, perPage }) => { try { const activities = await anilist.activity.getUserActivity( user, page, perPage, ); return { content: [ { type: "text", text: JSON.stringify(activities, null, 2), }, ], }; } catch (error: any) { return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true, }; } },
- tools/activity.ts:89-101 (schema)The Zod input schema defining the parameters for the 'get_user_activity' tool: user (AniList ID), page (optional, default 1), perPage (optional, default 25, max 25).{ user: z.number().describe("The user's AniList ID"), page: z .number() .optional() .default(1) .describe("The page number to display"), perPage: z .number() .optional() .default(25) .describe("How many entries to display on one page (max 25)"), },
- tools/activity.ts:85-129 (registration)The complete registration of the 'get_user_activity' tool within the registerActivityTools function using server.tool, including name, description, input schema, metadata hints, and handler.// anilist.activity.getUserActivity() server.tool( "get_user_activity", "Fetch activities from a user", { user: z.number().describe("The user's AniList ID"), page: z .number() .optional() .default(1) .describe("The page number to display"), perPage: z .number() .optional() .default(25) .describe("How many entries to display on one page (max 25)"), }, { title: "Get a User's AniList Activities", readOnlyHint: true, openWorldHint: true, }, async ({ user, page, perPage }) => { try { const activities = await anilist.activity.getUserActivity( user, page, perPage, ); return { content: [ { type: "text", text: JSON.stringify(activities, null, 2), }, ], }; } catch (error: any) { return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true, }; } }, );