model_template_reposition
Reposition templates within a model on Anki MCP by specifying the model name, template name, and desired 0-based index for the new position.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| index | Yes | New position for the template (0-based) | |
| modelName | Yes | Name of the model | |
| templateName | Yes | Name of the template to reposition |
Implementation Reference
- src/tools/model.ts:418-445 (registration)Registration of the 'model_template_reposition' MCP tool using server.tool, including inline schema and handler function that delegates to ankiClient.model.modelTemplateReposition.'model_template_reposition', { modelName: z.string().describe('Name of the model'), templateName: z.string().describe('Name of the template to reposition'), index: z.number().describe('New position for the template (0-based)'), }, async ({ modelName, templateName, index }) => { try { await ankiClient.model.modelTemplateReposition({ modelName, templateName, index, }); return { content: [ { type: 'text', text: `Successfully repositioned template "${templateName}" to position ${index} in model "${modelName}"`, }, ], }; } catch (error) { throw new Error( `Failed to reposition template "${templateName}" in model "${modelName}": ${error instanceof Error ? error.message : String(error)}` ); } } );
- src/tools/model.ts:424-444 (handler)Handler function executing the tool logic: repositions the template in the model via AnkiConnect client and returns success/error response.async ({ modelName, templateName, index }) => { try { await ankiClient.model.modelTemplateReposition({ modelName, templateName, index, }); return { content: [ { type: 'text', text: `Successfully repositioned template "${templateName}" to position ${index} in model "${modelName}"`, }, ], }; } catch (error) { throw new Error( `Failed to reposition template "${templateName}" in model "${modelName}": ${error instanceof Error ? error.message : String(error)}` ); } }
- src/tools/model.ts:419-423 (schema)Zod schema defining input parameters for the model_template_reposition tool.{ modelName: z.string().describe('Name of the model'), templateName: z.string().describe('Name of the template to reposition'), index: z.number().describe('New position for the template (0-based)'), },