azure-typespec-author
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAzure TypeSpec Author
Azure TypeSpec 编写工具
MCP Prerequisites
MCP 前置条件
Requires server with TypeSpec authoring and validation tools.
azure-sdk-mcp需要配备TypeSpec编写和验证工具的服务器。
azure-sdk-mcpMCP Tools
MCP 工具
| Tool | Purpose |
|---|---|
| Generate grounded authoring plan |
| Validate TypeSpec compilation + lint |
| 工具名称 | 用途 |
|---|---|
| 生成基于实际情况的编写计划 |
| 验证TypeSpec编译及代码检查结果 |
Principles
原则
- Mandatory for ALL edits — even a single
.tspchange can be breaking.? - Minimal, scoped edits — only change what the request requires.
- Always validate — run after every edit.
azsdk_run_typespec_validation - Always cite references — provide links that justify the approach.
- 所有.tsp文件编辑必须遵循——即使是单个的修改也可能导致破坏性变更。
? - 最小化、范围明确的编辑——仅修改请求要求的内容。
- 始终执行验证——每次编辑后运行。
azsdk_run_typespec_validation - 始终引用参考资料——提供证明方法合理性的链接。
Task Classification
任务分类
Classify every request into exactly one of the two types below before proceeding.
- API Version Evolution = adding a brand-new API version string (e.g. ) to the service. This is only about creating a new version entry and carrying over / excluding features. It is not about adding
2025-06-01-preview/@addeddecorators to individual properties or operations within an existing version — that falls under General Authoring.@removed - General Authoring = everything else that modifies files.
.tsp
| Type | Description | Examples |
|---|---|---|
| API Version Evolution (ARM only) | Adding a new preview or stable API version to an existing ARM service. Data-plane API version evolution is not fully supported yet. | "Add a new preview API version 2026-01-01-preview for widget resource manager" |
| General Authoring | Any other TypeSpec authoring task that modifies | "Add an ARM resource named Asset with CRUD operations" |
在开始处理前,需将每个请求准确归类为以下两种类型之一。
- API版本演进 = 为服务添加全新的API版本字符串(例如)。这仅涉及创建新版本条目以及保留/排除功能,不包括在现有版本的单个属性或操作中添加
2025-06-01-preview/@added装饰器——此类操作属于通用编写。@removed - 通用编写 = 所有其他修改.tsp文件的操作。
| 类型 | 描述 | 示例 |
|---|---|---|
| API版本演进(仅ARM) | 为现有ARM服务添加新的预览版或稳定版API版本。数据平面API版本演进目前尚未完全支持。 | "为Widget资源管理器添加新的预览版API版本2026-01-01-preview" |
| 通用编写 | 所有其他修改.tsp文件的TypeSpec编写任务 | "添加一个名为Asset的ARM资源并支持CRUD操作" |
Steps
步骤
All tasks follow a 5-step workflow. Steps 2–3 branch by task type; the rest are shared.
-
Analyze Project — Follow the project analysis guide to collect project context and determine task type.
-
Intake & Clarification
-
API Version Evolution: determine the versioning scenario from Step 1, use agentic search in the document with the scenario URL below to collect information from user. Be sure to use a user-friendly way to collect required inputs from user. e.g., list the existing features (resources, operations, properties) from the latest version and then ask the user which to carry over or exclude, instead of asking for raw input.
Latest Target URL to fetch preview preview https://azure.github.io/typespec-azure/docs/howtos/versioning/arm/02-preview-after-preview/preview stable https://azure.github.io/typespec-azure/docs/howtos/versioning/arm/03-stable-after-preview/stable preview https://azure.github.io/typespec-azure/docs/howtos/versioning/arm/04-preview-after-stable/stable stable https://azure.github.io/typespec-azure/docs/howtos/versioning/arm/05-stable-after-stable/ -
General Authoring: follow intake guide.
-
-
Retrieve Solution
-
API Version Evolution: search the downloaded guide content for implementation steps via agentic search and generate solution. No MCP tool call needed.
-
General Authoring: invokeMCP tool with the following parameters:
azsdk_typespec_generate_authoring_planParameter Value requestUser request (verbatim) additionalInformationAll content gathered from Steps 1–2 (intake analysis, user answers, relevant code read from the project).tsptypeSpecProjectRootPathTypeSpec project root path Do not proceed without a grounded plan from this tool.
-
-
Apply Changes — Confirm uncertainties with user, make minimaledits, prefer official templates from retrieved context.
.tsp -
Validate — Follow the validation guide.
所有任务均遵循五步工作流。步骤2-3根据任务类型分支,其余步骤为通用步骤。
-
分析项目 — 遵循项目分析指南收集项目上下文并确定任务类型。
-
需求收集与澄清
-
API版本演进: 从步骤1确定版本场景,使用智能搜索在下方对应场景的URL文档中收集用户信息。请确保采用用户友好的方式收集所需输入,例如列出最新版本的现有功能(资源、操作、属性),然后询问用户保留或排除哪些,而非直接要求原始输入。
当前版本 目标版本 获取URL preview preview https://azure.github.io/typespec-azure/docs/howtos/versioning/arm/02-preview-after-preview/preview stable https://azure.github.io/typespec-azure/docs/howtos/versioning/arm/03-stable-after-preview/stable preview https://azure.github.io/typespec-azure/docs/howtos/versioning/arm/04-preview-after-stable/stable stable https://azure.github.io/typespec-azure/docs/howtos/versioning/arm/05-stable-after-stable/ -
通用编写: 遵循需求收集指南。
-
-
获取解决方案
-
API版本演进: 通过智能搜索在下载的指南内容中查找实现步骤并生成解决方案。无需调用MCP工具。
-
通用编写: 使用以下参数调用MCP工具:
azsdk_typespec_generate_authoring_plan参数名称 取值 request用户请求(原文) additionalInformation步骤1-2中收集的所有内容(需求收集分析、用户回答、从项目中读取的相关.tsp代码) typeSpecProjectRootPathTypeSpec项目根路径 在未获取该工具生成的基于实际情况的计划前,请勿继续。
-
-
应用变更 — 与用户确认不确定的内容,进行最小化的.tsp文件编辑,优先使用从参考内容中获取的官方模板。
-
验证 — 遵循验证指南