model_field_set_font
Set custom fonts for specific fields in Anki card models to enhance visual customization and improve readability during study sessions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fieldName | Yes | Name of the field | |
| font | Yes | Font name to set | |
| modelName | Yes | Name of the model |
Implementation Reference
- src/tools/model.ts:268-288 (handler)The handler function for the 'model_field_set_font' MCP tool. It calls the Anki client to set the font for a specific field in a model and returns a success message or throws an error.try { await ankiClient.model.modelFieldSetFont({ modelName, fieldName, font, }); return { content: [ { type: 'text', text: `Successfully set font "${font}" for field "${fieldName}" in model "${modelName}"`, }, ], }; } catch (error) { throw new Error( `Failed to set font for field "${fieldName}" in model "${modelName}": ${error instanceof Error ? error.message : String(error)}` ); } } );
- src/tools/model.ts:263-267 (schema)Zod schema defining the input parameters for the 'model_field_set_font' tool: modelName (string), fieldName (string), font (string).modelName: z.string().describe('Name of the model'), fieldName: z.string().describe('Name of the field'), font: z.string().describe('Font name to set'), }, async ({ modelName, fieldName, font }) => {
- src/tools/model.ts:261-288 (registration)Registration of the 'model_field_set_font' tool with the MCP server using server.tool, including schema and handler.'model_field_set_font', { modelName: z.string().describe('Name of the model'), fieldName: z.string().describe('Name of the field'), font: z.string().describe('Font name to set'), }, async ({ modelName, fieldName, font }) => { try { await ankiClient.model.modelFieldSetFont({ modelName, fieldName, font, }); return { content: [ { type: 'text', text: `Successfully set font "${font}" for field "${fieldName}" in model "${modelName}"`, }, ], }; } catch (error) { throw new Error( `Failed to set font for field "${fieldName}" in model "${modelName}": ${error instanceof Error ? error.message : String(error)}` ); } } );