clone_deck_config
Duplicate an Anki deck configuration by specifying its ID and assigning a new name, enabling quick replication of settings for streamlined deck management.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| newConfigName | Yes | Name for the new cloned configuration | |
| sourceConfigId | Yes | ID of the deck configuration to clone from |
Implementation Reference
- src/tools/decks.ts:102-127 (handler)Handler function that clones the deck configuration by calling ankiClient.deck.cloneDeckConfigId with sourceConfigId and newConfigName, handles success and error cases, and returns structured content.async ({ sourceConfigId, newConfigName }) => { try { const result = await ankiClient.deck.cloneDeckConfigId({ cloneFrom: sourceConfigId, name: newConfigName, }); if (result === false) { throw new Error('Failed to clone deck configuration - operation returned false'); } return { content: [ { type: 'text', text: `Successfully cloned deck configuration. New config ID: ${result}`, }, ], }; } catch (error) { throw new Error( `Failed to clone deck configuration: ${error instanceof Error ? error.message : String(error)}` ); } } );
- src/tools/decks.ts:98-101 (schema)Zod schema for input parameters: sourceConfigId (number) and newConfigName (string).{ sourceConfigId: z.number().describe('ID of the deck configuration to clone from'), newConfigName: z.string().describe('Name for the new cloned configuration'), },
- src/tools/decks.ts:96-127 (registration)MCP tool registration using server.tool, including name 'clone_deck_config', input schema, and inline handler implementation.server.tool( 'clone_deck_config', { sourceConfigId: z.number().describe('ID of the deck configuration to clone from'), newConfigName: z.string().describe('Name for the new cloned configuration'), }, async ({ sourceConfigId, newConfigName }) => { try { const result = await ankiClient.deck.cloneDeckConfigId({ cloneFrom: sourceConfigId, name: newConfigName, }); if (result === false) { throw new Error('Failed to clone deck configuration - operation returned false'); } return { content: [ { type: 'text', text: `Successfully cloned deck configuration. New config ID: ${result}`, }, ], }; } catch (error) { throw new Error( `Failed to clone deck configuration: ${error instanceof Error ? error.message : String(error)}` ); } } );