UNPKG

@codewithdan/dc-comics-mcp

Version:

DC Comics APIs MCP Server using Comic Vine API

20 lines (19 loc) 846 B
import { markdownInstructions } from "../../instructions.js"; import { IssueSchema, ResponseStatusSchema } from "../schemas.js"; import { GetIssueByIdSchema } from "./schemas.js"; import { getResourceById } from "../../utils.js"; export const get_issue_by_id = { description: `Fetch a single DC Comics issue by ID. ${markdownInstructions}`, schema: GetIssueByIdSchema, handler: async (args) => { const argsParsed = GetIssueByIdSchema.parse(args); // Use the helper function to get an issue by ID const res = await getResourceById('ISSUE', argsParsed.issueId, argsParsed.field_list); // Validate the response and results const issueResponse = { ...ResponseStatusSchema.parse(res), results: IssueSchema.parse(res.results) }; return issueResponse; } };