model_template_rename
Renames a template within a specified model on Anki MCP, allowing users to update template names for better organization and clarity.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| modelName | Yes | Name of the model | |
| newTemplateName | Yes | New name for the template | |
| oldTemplateName | Yes | Current name of the template |
Implementation Reference
- src/tools/model.ts:393-413 (handler)Handler function that performs the model template rename operation by calling the Anki client and handles success/error responses.async ({ modelName, oldTemplateName, newTemplateName }) => { try { await ankiClient.model.modelTemplateRename({ modelName, oldTemplateName, newTemplateName, }); return { content: [ { type: 'text', text: `Successfully renamed template "${oldTemplateName}" to "${newTemplateName}" in model "${modelName}"`, }, ], }; } catch (error) { throw new Error( `Failed to rename template in model "${modelName}": ${error instanceof Error ? error.message : String(error)}` ); } }
- src/tools/model.ts:388-392 (schema)Input schema using Zod for validating parameters: modelName, oldTemplateName, newTemplateName.{ modelName: z.string().describe('Name of the model'), oldTemplateName: z.string().describe('Current name of the template'), newTemplateName: z.string().describe('New name for the template'), },
- src/tools/model.ts:386-414 (registration)Registration of the 'model_template_rename' tool with the MCP server, including the tool name, input schema, and handler function.server.tool( 'model_template_rename', { modelName: z.string().describe('Name of the model'), oldTemplateName: z.string().describe('Current name of the template'), newTemplateName: z.string().describe('New name for the template'), }, async ({ modelName, oldTemplateName, newTemplateName }) => { try { await ankiClient.model.modelTemplateRename({ modelName, oldTemplateName, newTemplateName, }); return { content: [ { type: 'text', text: `Successfully renamed template "${oldTemplateName}" to "${newTemplateName}" in model "${modelName}"`, }, ], }; } catch (error) { throw new Error( `Failed to rename template in model "${modelName}": ${error instanceof Error ? error.message : String(error)}` ); } } );