search_character
Find characters on AniList by entering a search term, specifying page number, and results per page (max 25).
Instructions
Search for characters based on a query term
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | No | Results per page (max 25) | |
| page | No | Page number for results | |
| term | Yes | Search term for finding characters |
Implementation Reference
- tools/search.ts:153-170 (handler)The handler function for the 'search_character' tool. It performs the search using the AniList client's searchEntry.character method and returns the results as JSON or an error message.async ({ term, page, amount }) => { try { const results = await anilist.searchEntry.character(term, page, amount); return { content: [ { type: "text", text: JSON.stringify(results, null, 2), }, ], }; } catch (error: any) { return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true, }; } },
- tools/search.ts:135-147 (schema)Zod input schema defining parameters for the 'search_character' tool: term (required string), page and amount (optional numbers with defaults).{ term: z.string().describe("Search term for finding characters"), page: z .number() .optional() .default(1) .describe("Page number for results"), amount: z .number() .optional() .default(5) .describe("Results per page (max 25)"), },
- tools/search.ts:132-172 (registration)Registration of the 'search_character' tool via server.tool(), including name, description, input schema, metadata hints, and handler function.server.tool( "search_character", "Search for characters based on a query term", { term: z.string().describe("Search term for finding characters"), page: z .number() .optional() .default(1) .describe("Page number for results"), amount: z .number() .optional() .default(5) .describe("Results per page (max 25)"), }, { title: "AniList Character Search", readOnlyHint: true, openWorldHint: true, }, async ({ term, page, amount }) => { try { const results = await anilist.searchEntry.character(term, page, amount); return { content: [ { type: "text", text: JSON.stringify(results, null, 2), }, ], }; } catch (error: any) { return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true, }; } }, );