get_card_by_id
Retrieve detailed information for a specific Yu-Gi-Oh! card using its unique ID. Input the card ID to access card details instantly via the ygocdb-mcp server.
Instructions
通过卡牌ID获取单张游戏王卡牌的详细信息
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | 游戏王卡牌ID,通常为八位数字 |
Implementation Reference
- index.ts:197-201 (handler)The main handler function that fetches the card data from YGOCDB API using the provided ID as a search query and processes the response using the shared response handler.async function handleGetCardById(id: string, config?: z.infer<typeof configSchema>) { const url = `${config?.apiUrl || BASE_URL}/?search=${encodeURIComponent(id)}`; const response = await fetch(url); return handleYgocdbResponse(response); }
- index.ts:94-112 (schema)The Tool object defining the schema, including inputSchema for the 'id' parameter (string, required), description, and annotations.const GET_CARD_BY_ID_TOOL: Tool = { name: "get_card_by_id", description: "通过卡牌ID获取单张游戏王卡牌的详细信息", inputSchema: { type: "object", properties: { id: { type: "string", description: "游戏王卡牌ID,通常为八位数字" } }, required: ["id"] }, annotations: { title: "通过ID获取单张游戏王卡牌", readOnlyHint: true, openWorldHint: true } };
- index.ts:136-140 (registration)The tool is registered in the YGOCDB_TOOLS array, which is returned by the listTools request handler.const YGOCDB_TOOLS = [ SEARCH_CARDS_TOOL, GET_CARD_BY_ID_TOOL, GET_CARD_IMAGE_TOOL ] as const;
- index.ts:289-292 (registration)The tool name is matched in the switch statement within the CallToolRequestSchema handler, dispatching to the handleGetCardById function.case "get_card_by_id": { const { id } = args as { id: string }; return await handleGetCardById(id, config); }