Skip to main content
Glama

search_activity

Search and filter AniList activity data by ID, user, media, type, or creation date, enabling precise retrieval of user interactions and content updates.

Instructions

Search for activities on AniList

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
activityIDNoThe activity ID to lookup (leave it as undefined for no specific ID)
filterNoFilter object for searching activities (leave it as undefined for no specific filter)
pageNoPage number for results
perPageNoResults per page (max 25)

Implementation Reference

  • Executes the tool logic by searching for activities using the AniList client and returning JSON-formatted results or an error message.
    async ({ activityID, filter, page, perPage }) => { try { const results = await anilist.searchEntry.activity( activityID, filter, page, perPage, ); return { content: [ { type: "text", text: JSON.stringify(results, null, 2), }, ], }; } catch (error: any) { return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true, }; } },
  • Input schema for the search_activity tool parameters using Zod.
    { activityID: z .number() .optional() .describe( "The activity ID to lookup (leave it as undefined for no specific ID)", ), filter: ActivityFilterTypesSchema.optional().describe( "Filter object for searching activities (leave it as undefined for no specific filter)", ), page: z .number() .optional() .default(1) .describe("Page number for results"), perPage: z .number() .optional() .default(5) .describe("Results per page (max 25)"), },
  • Zod schema definition for ActivityFilterTypesSchema, used as the type for the 'filter' parameter in search_activity.
    export const ActivityFilterTypesSchema = z.object({ id: z.number().optional().describe("The id of the activity"), userId: z .number() .optional() .describe("The userID of the account with the activity"), messengerId: z.number().optional().describe("The ID of who sent the message"), mediaId: z.number().optional().describe("The ID of the media"), type: ActivityTypeSchema.optional().describe("The type of activity"), isFollowing: z .boolean() .optional() .describe( "[Requires Login] Filter users by who is following the authorized user", ), hasReplies: z .boolean() .optional() .describe("Filter by which activities have replies"), hasRepliesOrTypeText: z .boolean() .optional() .describe("Filter by which activities have replies or text"), createdAt: z .number() .optional() .describe("The time at which the activity was created"), id_not: z .number() .optional() .describe("Exclude an activity with the given ID"), id_in: z .array(z.number()) .optional() .describe("Include any activities with the given IDs"), id_not_in: z .array(z.number()) .optional() .describe("Excludes any activities with the given IDs"), userId_not: z .number() .optional() .describe("Exclude any activity with the given userID"), userId_in: z .array(z.number()) .optional() .describe("Includes any activity with the given userIDs"), userId_not_in: z .array(z.number()) .optional() .describe("Exclude any activity with the given userIDs"), messengerId_not: z .number() .optional() .describe("Exclude any activity with the given message sender ID"), messengerId_in: z .array(z.number()) .optional() .describe("Include any activity with the given message sender IDs"), messengerId_not_in: z .array(z.number()) .optional() .describe("Exclude any activity with the given message sender IDs"), mediaId_not: z .number() .optional() .describe("Exclude any activity with the given media ID"), mediaId_in: z .array(z.number()) .optional() .describe("Include any activity with the given media IDs"), mediaId_not_in: z .array(z.number()) .optional() .describe("Exclude any activity with the given media IDs"), type_not: ActivityTypeSchema.optional().describe( "Exclude any activity with the same ActivityType", ), type_in: z .array(ActivityTypeSchema) .optional() .describe("Include any activity with the given ActivityTypes"), type_not_in: z .array(ActivityTypeSchema) .optional() .describe("Exclude any activity with the given ActivityTypes"), createdAt_greater: z .number() .optional() .describe("Include any activity created at the given date or more recent"), createdAt_lesser: z .number() .optional() .describe("Include any activity created at the given date or less recent"), sort: z .array(ActivitySortSchema) .optional() .describe("Sort the query by the parameters given."), });
  • tools/search.ts:12-64 (registration)
    Registers the 'search_activity' tool on the MCP server with its name, description, input schema, metadata, and handler function.
    server.tool( "search_activity", "Search for activities on AniList", { activityID: z .number() .optional() .describe( "The activity ID to lookup (leave it as undefined for no specific ID)", ), filter: ActivityFilterTypesSchema.optional().describe( "Filter object for searching activities (leave it as undefined for no specific filter)", ), page: z .number() .optional() .default(1) .describe("Page number for results"), perPage: z .number() .optional() .default(5) .describe("Results per page (max 25)"), }, { title: "AniList Activity Search", readOnlyHint: true, openWorldHint: true, }, async ({ activityID, filter, page, perPage }) => { try { const results = await anilist.searchEntry.activity( activityID, filter, page, perPage, ); return { content: [ { type: "text", text: JSON.stringify(results, null, 2), }, ], }; } catch (error: any) { return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true, }; } }, );
  • tools/index.ts:37-37 (registration)
    Invokes registerSearchTools to register all search tools including search_activity.
    registerSearchTools(server, anilist);

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