autocomplete
Complete Magic: The Gathering card names from partial input to speed up searches in the Scryfall MCP Server.
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. It takes a query 'q', calls Scryfall.autocomplete(q), and returns the result as JSON 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:232-232 (schema)Zod input schema for the autocomplete tool: requires a string query 'q'.const autocompleteParamsShape = { q: z.string() } as const;
- src/mcp-server.ts:234-244 (registration)Registration of the 'autocomplete' tool with MCP server, including name, description, input schema, and handler.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/scryfall.ts:105-105 (helper)Helper method in Scryfall object that makes API call to Scryfall's /cards/autocomplete endpoint.autocomplete: (q: string) => getJson("/cards/autocomplete", { q }),