autocomplete
Suggests Magic: The Gathering card names as you type to help quickly find specific cards during searches.
Instructions
Autocomplete card names based on a partial query.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| q | Yes |
Implementation Reference
- src/mcp-server.ts:240-243 (handler)The handler function for the autocomplete tool, which calls Scryfall.autocomplete and returns the response as JSON-formatted text content.async ({ q }: { q: string }): Promise<ToolResult> => { const data: unknown = await Scryfall.autocomplete(q); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] } as any; }
- src/mcp-server.ts:234-244 (registration)Registers the autocomplete tool with the MCP server using server.registerTool, including description and input schema.server.registerTool( "autocomplete", { description: "Autocomplete card names based on a partial query.", inputSchema: autocompleteParamsShape }, async ({ q }: { q: string }): Promise<ToolResult> => { const data: unknown = await Scryfall.autocomplete(q); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] } as any; } );
- src/mcp-server.ts:232-232 (schema)Zod input schema definition for the autocomplete tool parameters: { q: z.string() }.const autocompleteParamsShape = { q: z.string() } as const;
- src/scryfall.ts:105-105 (helper)Helper method in Scryfall object that performs the actual API call to /cards/autocomplete endpoint.autocomplete: (q: string) => getJson("/cards/autocomplete", { q }),