model_field_rename
Rename a specific field within a named model in Anki MCP by providing the current and new field names. Streamline model updates for improved organization.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| modelName | Yes | Name of the model | |
| newFieldName | Yes | New name for the field | |
| oldFieldName | Yes | Current name of the field |
Implementation Reference
- src/tools/model.ts:175-195 (handler)The handler function that performs the actual model field renaming by invoking ankiClient.model.modelFieldRename and returns a success message or throws an error.try { await ankiClient.model.modelFieldRename({ modelName, oldFieldName, newFieldName, }); return { content: [ { type: 'text', text: `Successfully renamed field "${oldFieldName}" to "${newFieldName}" in model "${modelName}"`, }, ], }; } catch (error) { throw new Error( `Failed to rename field in model "${modelName}": ${error instanceof Error ? error.message : String(error)}` ); } } );
- src/tools/model.ts:170-174 (schema)Zod schema validating the input parameters for the tool: modelName (string), oldFieldName (string), newFieldName (string).modelName: z.string().describe('Name of the model'), oldFieldName: z.string().describe('Current name of the field'), newFieldName: z.string().describe('New name for the field'), }, async ({ modelName, oldFieldName, newFieldName }) => {
- src/tools/model.ts:168-196 (registration)The registration of the 'model_field_rename' tool within the registerModelTools function using server.tool(name, inputSchema, handler).'model_field_rename', { modelName: z.string().describe('Name of the model'), oldFieldName: z.string().describe('Current name of the field'), newFieldName: z.string().describe('New name for the field'), }, async ({ modelName, oldFieldName, newFieldName }) => { try { await ankiClient.model.modelFieldRename({ modelName, oldFieldName, newFieldName, }); return { content: [ { type: 'text', text: `Successfully renamed field "${oldFieldName}" to "${newFieldName}" in model "${modelName}"`, }, ], }; } catch (error) { throw new Error( `Failed to rename field in model "${modelName}": ${error instanceof Error ? error.message : String(error)}` ); } } );