get_card_by_set_and_number
Retrieve detailed Magic: The Gathering Chinese card data by specifying the set code and collector number. Enhance applications or workflows with precise card information from sbwsz-mcp.
Instructions
通过系列代码和收集编号获取单张卡牌。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collector_number | Yes | 收集编号,例如 '1'、'112'、'1a' | |
| set | Yes | 系列代码,例如 'NEO'、'MOM' |
Implementation Reference
- index.ts:326-330 (handler)The main handler function that constructs the API URL using the provided set and collector number, fetches the card data, and processes the response.async function handleGetCardBySetAndNumber(set: string, collectorNumber: string, config: z.infer<typeof configSchema>) { const url = `${config.apiUrl}/card/${encodeURIComponent(set)}/${encodeURIComponent(collectorNumber)}`; const response = await fetch(url); return handleSbwszResponse(response); }
- index.ts:83-106 (schema)Defines the tool schema including name, description, input parameters (set and collector_number), and annotations for the MCP tool.const GET_CARD_BY_SET_AND_NUMBER_TOOL: Tool = { name: "get_card_by_set_and_number", description: "通过系列代码和收集编号获取单张卡牌。", inputSchema: { type: "object", properties: { set: { type: "string", description: "系列代码,例如 'NEO'、'MOM'" }, collector_number: { type: "string", description: "收集编号,例如 '1'、'112'、'1a'" } }, required: ["set", "collector_number"] }, annotations: { title: "由系列代码和收集编号获取单张卡牌", readOnlyHint: true, openWorldHint: true } };
- index.ts:269-276 (registration)Registers the get_card_by_set_and_number tool in the array of available tools, which is returned by the ListToolsRequest handler.const SBWSZ_TOOLS = [ GET_CARD_BY_SET_AND_NUMBER_TOOL, SEARCH_CARDS_TOOL, GET_SETS_TOOL, GET_SET_TOOL, GET_SET_CARDS_TOOL, HZLS_TOOL ] as const;
- index.ts:487-489 (registration)Registers the handler for ListToolsRequestSchema, which provides the list of tools including get_card_by_set_and_number.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: SBWSZ_TOOLS }));
- index.ts:496-499 (registration)Dispatches calls to the get_card_by_set_and_number tool by invoking the handleGetCardBySetAndNumber function in the CallToolRequestSchema handler.case "get_card_by_set_and_number": { const { set, collector_number } = args as { set: string; collector_number: string }; return await handleGetCardBySetAndNumber(set.toUpperCase(), collector_number, config); }