gui_import_file
Import files into Anki MCP by specifying the file path using this tool. Streamline data integration and enhance workflow efficiency.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Path to the file to import |
Implementation Reference
- src/tools/graphical.ts:271-287 (handler)The handler function for the 'gui_import_file' tool. It takes a filePath parameter and calls ankiClient.graphical.guiImportFile to perform the import, returning a success message or throwing an error.async ({ filePath }) => { try { await ankiClient.graphical.guiImportFile({ path: filePath }); return { content: [ { type: 'text', text: `Successfully imported file: ${filePath}`, }, ], }; } catch (error) { throw new Error( `Failed to import file: ${error instanceof Error ? error.message : String(error)}` ); } }
- src/tools/graphical.ts:268-270 (schema)The Zod input schema for the 'gui_import_file' tool, defining the required 'filePath' string parameter.{ filePath: z.string().describe('Path to the file to import'), },
- src/tools/graphical.ts:266-288 (registration)The complete registration of the 'gui_import_file' MCP tool using server.tool(), including name, schema, and inline handler function.server.tool( 'gui_import_file', { filePath: z.string().describe('Path to the file to import'), }, async ({ filePath }) => { try { await ankiClient.graphical.guiImportFile({ path: filePath }); return { content: [ { type: 'text', text: `Successfully imported file: ${filePath}`, }, ], }; } catch (error) { throw new Error( `Failed to import file: ${error instanceof Error ? error.message : String(error)}` ); } } );