search_manga
Search for manga using query terms and filters like genre, tag, format, or publication date. Access results sorted by criteria such as popularity, score, or release date.
Instructions
Search for manga with query term and filters
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | No | Results per page (max 25) | |
| filter | No | Filter object for searching manga. You MUST NOT include "{ "type": "MANGA" }" in the filter object. As it is already included in the API call. When no sorting method or any filter is specified, you SHOULD use the site default: "{ "sort": ["SEARCH_MATCH"] }". Otherwise, request is likely to fail or return no results. | |
| page | No | Page number for results | |
| term | No | Query term for finding manga (leave it as undefined when no query term specified.) Query term is used for searching with specific word or title in mind. You SHOULD not include things that can be found in the filter object, such as genre or tag. Those things should be included in the filter object instead. To check whether a user requested term should be considered as a query term or a filter term. It is recommended to use tools like 'get_genres' and 'get_media_tags' first. |
Implementation Reference
- tools/search.ts:213-235 (handler)Handler function that executes the search_manga tool by calling anilist.searchEntry.manga with provided term, filter, page, and amount parameters, returning JSON-stringified results or an error message.async ({ term, filter, page, amount }) => { try { const results = await anilist.searchEntry.manga( term, filter, 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:177-207 (schema)Zod input schema defining parameters for search_manga: optional term (string), filter (MediaFilterTypesSchema), page (number, default 1), amount (number, default 5). Includes detailed descriptions.{ term: z .string() .optional() .describe( `Query term for finding manga (leave it as undefined when no query term specified.) Query term is used for searching with specific word or title in mind. You SHOULD not include things that can be found in the filter object, such as genre or tag. Those things should be included in the filter object instead. To check whether a user requested term should be considered as a query term or a filter term. It is recommended to use tools like 'get_genres' and 'get_media_tags' first.`, ), filter: MediaFilterTypesSchema.optional().describe( `Filter object for searching manga. You MUST NOT include "{ "type": "MANGA" }" in the filter object. As it is already included in the API call. When no sorting method or any filter is specified, you SHOULD use the site default: "{ "sort": ["SEARCH_MATCH"] }". Otherwise, request is likely to fail or return no results.`, ), 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:174-236 (registration)Registration of the search_manga tool via server.tool(), specifying name, description, input schema, hints (title, readOnlyHint, openWorldHint), and handler function within the registerSearchTools function.server.tool( "search_manga", "Search for manga with query term and filters", { term: z .string() .optional() .describe( `Query term for finding manga (leave it as undefined when no query term specified.) Query term is used for searching with specific word or title in mind. You SHOULD not include things that can be found in the filter object, such as genre or tag. Those things should be included in the filter object instead. To check whether a user requested term should be considered as a query term or a filter term. It is recommended to use tools like 'get_genres' and 'get_media_tags' first.`, ), filter: MediaFilterTypesSchema.optional().describe( `Filter object for searching manga. You MUST NOT include "{ "type": "MANGA" }" in the filter object. As it is already included in the API call. When no sorting method or any filter is specified, you SHOULD use the site default: "{ "sort": ["SEARCH_MATCH"] }". Otherwise, request is likely to fail or return no results.`, ), 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 Manga Search", readOnlyHint: true, openWorldHint: true, }, async ({ term, filter, page, amount }) => { try { const results = await anilist.searchEntry.manga( term, filter, 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, }; } }, );