@codewithdan/marvel-mcp
Version:
Marvel APIs MCP Server demo
14 lines (13 loc) • 565 B
JavaScript
// src/tools/get_character_by_id/index.ts
import { CharacterDataWrapperSchema } from "../schemas.js";
import { httpRequest } from "../../utils.js";
import { GetCharacterByIdSchema } from "./schemas.js";
export const get_character_by_id = {
description: `Fetch a Marvel character by ID.`,
schema: GetCharacterByIdSchema,
handler: async (args) => {
const argsParsed = GetCharacterByIdSchema.parse(args);
const res = await httpRequest(`/characters/${argsParsed.characterId}`);
return CharacterDataWrapperSchema.parse(res);
}
};