用途:该技能加载使用 @umbraco-cms/mcp-server-sdk 构建 MCP 工具的综合模式,适用于开始创建新的 MCP 工具、需要工具模式参考、了解如何使用工具包辅助函数,以及搭建新的 MCP 服务器项目。
主要能力:提供工具定义结构(name、description、inputSchema、outputSchema、slices、annotations、handler,并经 withStandardDecorators 导出);API 客户端配置 configureApiClient;辅助函数 executeGetApiCall(GET)、executeVoidApiCall(DELETE/PUT 无返回)、createToolResult 与 createToolResultError(自定义响应,如 CREATE);slices 分类(read、create、update、delete、search);annotations 参考(GET 用 readOnlyHint,DELETE 用 destructiveHint,PUT 用 idempotentHint;注意 DELETE 不具幂等性,第二次调用返回 404);嵌套引用对象的 schema 展平(对 parent: { id } 或 parent: { path } 接受扁平标量 parentId / path,在 handler 内重建);项目结构与 Orval 代码生成(npm run generate,orval.config.ts 生成 TypeScript 客户端与 Zod schema)。
使用方式:在工具开发时按模式定义工具,服务启动时配置 API 客户端,使用对应辅助函数处理各类 API 调用,通过 Orval 从 OpenAPI 生成客户端与 Zod schema。
最佳实践与限制:使用生成代码的 Zod schema 保证类型安全;UUID 在内部生成,不交给 LLM 提供;描述清晰、命名一致({action}-{entity});错误由 withStandardDecorators 自动处理;嵌套引用对象需展平。完整细节见 references/schema-flattening.md。具体收费与平台信息暂未提供。