Skip to main content
Glama

import_package

Import package files into Anki MCP by specifying the file path, enabling efficient integration and management of learning resources.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesPath to the package file to import

Implementation Reference

  • Full registration of the 'import_package' MCP tool, including inline schema validation and execution handler that calls the underlying AnkiConnect importPackage method.
    server.tool( 'import_package', { filePath: z.string().describe('Path to the package file to import'), }, async ({ filePath }) => { try { const result = await ankiClient.miscellaneous.importPackage({ path: filePath }); return { content: [ { type: 'text', text: `Successfully imported package from ${filePath}. Result: ${result}`, }, ], }; } catch (error) { throw new Error( `Failed to import package: ${error instanceof Error ? error.message : String(error)}` ); } } );
  • Core handler function for the import_package tool: validates input implicitly via schema, invokes ankiClient.miscellaneous.importPackage(path: filePath), and formats MCP response.
    async ({ filePath }) => { try { const result = await ankiClient.miscellaneous.importPackage({ path: filePath }); return { content: [ { type: 'text', text: `Successfully imported package from ${filePath}. Result: ${result}`, }, ], }; } catch (error) { throw new Error( `Failed to import package: ${error instanceof Error ? error.message : String(error)}` ); } }
  • Input schema using Zod: requires a single 'filePath' parameter as string with description.
    { filePath: z.string().describe('Path to the package file to import'), },
  • Secondary handler implementation as a case within the larger 'anki_operations' consolidated tool, providing similar import functionality.
    case 'import_package': { if (!filePath) { throw new Error('import_package requires filePath'); } await ankiClient.miscellaneous.importPackage({ path: filePath }); return { content: [ { type: 'text', text: `✓ Imported package from ${filePath}`, }, ], }; }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/arielbk/anki-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server