get_comics_for_character
Retrieve Marvel comics featuring a specific character by providing the character ID and optional filters such as format, creators, events, or date range.
Instructions
Fetch Marvel comics filtered by character ID and optional filters
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| characterId | Yes | ||
| collaborators | No | ||
| creators | No | ||
| dateDescriptor | No | ||
| dateRange | No | ||
| diamondCode | No | ||
| digitalId | No | ||
| ean | No | ||
| events | No | ||
| format | No | ||
| formatType | No | ||
| hasDigitalIssue | No | ||
| isbn | No | ||
| issn | No | ||
| issueNumber | No | ||
| limit | No | ||
| modifiedSince | No | ||
| noVariants | No | ||
| offset | No | ||
| orderBy | No | ||
| series | No | ||
| sharedAppearances | No | ||
| startYear | No | ||
| stories | No | ||
| title | No | ||
| titleStartsWith | No | ||
| upc | No |
Implementation Reference
- The async handler that parses the input arguments using the schema, extracts characterId and passes remaining filters as query params to the Marvel Comics API endpoint for the character, and parses the response using ComicDataWrapperSchema.handler: async (args: any) => { const { characterId, ...rest } = GetComicsForCharacterSchema.parse(args); const res = await httpRequest(`/characters/${characterId}/comics`, serializeQueryParams(rest)); return ComicDataWrapperSchema.parse(res); }
- Input schema for the tool using Zod. Extends GetCharacterByIdSchema (providing required 'characterId') with numerous optional comic-specific filters like format, dates, titles, numbers, identifiers, sorting, and pagination.export const GetComicsForCharacterSchema = GetCharacterByIdSchema.extend({ format: z.string().optional(), formatType: z.string().optional(), noVariants: z.boolean().optional(), dateDescriptor: z.string().optional(), dateRange: z.string().optional(), title: z.string().optional(), titleStartsWith: z.string().optional(), startYear: z.number().optional(), issueNumber: z.number().optional(), diamondCode: z.string().optional(), digitalId: z.number().optional(), upc: z.string().optional(), isbn: z.string().optional(), ean: z.string().optional(), issn: z.string().optional(), hasDigitalIssue: z.boolean().optional(), modifiedSince: z.string().optional(), creators: z.string().optional(), series: z.string().optional(), events: z.string().optional(), stories: z.string().optional(), sharedAppearances: z.string().optional(), collaborators: z.string().optional(), orderBy: z.string().optional(), limit: z.number().min(1).max(100).optional(), offset: z.number().optional(), });
- src/tools/get_comics_for_character/index.ts:6-14 (registration)Exports the complete tool object for registration in the MCP system, including description, input schema reference, and handler implementation.export const get_comics_for_character = { description: `Fetch Marvel comics filtered by character ID and optional filters.`, schema: GetComicsForCharacterSchema, handler: async (args: any) => { const { characterId, ...rest } = GetComicsForCharacterSchema.parse(args); const res = await httpRequest(`/characters/${characterId}/comics`, serializeQueryParams(rest)); return ComicDataWrapperSchema.parse(res); } };