get_templates
Retrieve available resume templates with details like ID, name, and thumbnails to help users select appropriate resume styles for NovaCV resume services.
Instructions
获取所有可用的简历模板,返回模板列表及其详细信息,包括模板ID、名称、缩略图等。帮助用户选择最适合的简历风格。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:205-226 (handler)The handler function for the 'get_templates' MCP tool. It calls novaCVService.getTemplates(), stringifies the result, and returns it in the expected MCP response format. Handles errors by returning an error message.async (_, extra) => { try { const templates = await novaCVService.getTemplates(); return { content: [ { type: "text", text: safeStringify(templates) } ], }; } catch (error: any) { return { content: [ { type: "text", text: `错误: ${error.message || "未知错误"}` } ], }; } }
- src/index.ts:201-227 (registration)Registers the 'get_templates' tool on the MCP server using server.tool(). Specifies the tool name, Chinese description, empty input schema ({}), and the handler function.server.tool( "get_templates", "获取所有可用的简历模板,返回模板列表及其详细信息,包括模板ID、名称、缩略图等。帮助用户选择最适合的简历风格。", {}, async (_, extra) => { try { const templates = await novaCVService.getTemplates(); return { content: [ { type: "text", text: safeStringify(templates) } ], }; } catch (error: any) { return { content: [ { type: "text", text: `错误: ${error.message || "未知错误"}` } ], }; } } );
- src/services/novacv.ts:125-133 (helper)NovaCVService.getTemplates() method: Fetches all available resume templates from the NovaCV API endpoint '/api/v1/templates' and returns the response data. Handles errors internally.async getTemplates(): Promise<any> { try { const response = await this.client.get('/api/v1/templates'); return response.data; } catch (error) { this._handleError(error); throw error; } }