Skip to content

Commit 9203796

Browse files
authored
Allow custom approval modes for lists of tools. (#36357)
* Allow custom approoval modes for lists of tools. * Simplify MCPRequiredApproval
1 parent 5d8e7af commit 9203796

File tree

3 files changed

+73
-14
lines changed

3 files changed

+73
-14
lines changed

specification/ai/Azure.AI.Agents/run_steps/models.tsp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,13 +312,13 @@ model RunStepDeltaCodeInterpreterToolCall extends RunStepDeltaToolCall {
312312
/** Represents the function data in a streaming run step MCP call.* */
313313
@added(Versions.v2025_05_15_preview)
314314
model RunStepDeltaMcpToolCall extends RunStepDeltaToolCall {
315-
/** The object type, which is always "mcp".* */
315+
/** The object type, which is always "mcp". */
316316
type: "mcp";
317317

318-
/** The index of a response. * */
318+
/** The index of a response. */
319319
index: int32;
320320

321-
/** The arguments for MCP call. * */
321+
/** The arguments for MCP call. */
322322
arguments: string;
323323
}
324324

specification/ai/Azure.AI.Agents/tools/tool_resources.tsp

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,41 @@ model MCPToolResource {
155155

156156
@doc("Does MCP server require approval")
157157
@encodedName("application/json", "require_approval")
158-
requireApproval?: "never" | "always" | string;
158+
requireApproval?: MCPRequiredApproval;
159+
}
160+
161+
/** The Union of approval types. */
162+
#suppress "@azure-tools/typespec-autorest/union-unsupported" "This union is defined according to the Azure OpenAI API."
163+
@added(Versions.v2025_05_15_preview)
164+
union MCPRequiredApproval {
165+
string,
166+
167+
/** The approval is not required for any of the tools. */
168+
`never`: "never",
169+
170+
/** The approval is required for all tools. */
171+
always: "always",
172+
173+
/** Customized MCP approval object, listing tools requiring and not requiring approvals */
174+
MCPApprovalPerTool,
175+
}
176+
177+
/** Customized MCP approval object, listing tools requiring and not requiring approvals */
178+
@added(Versions.v2025_05_15_preview)
179+
model MCPApprovalPerTool {
180+
/** The list of tools, not requiring approval. */
181+
`never`?: MCPToolList;
182+
183+
/** The list of tools, always requiring approval. */
184+
always?: MCPToolList;
185+
}
186+
187+
/** The object, containing list of tools for approvals. */
188+
@added(Versions.v2025_05_15_preview)
189+
model MCPToolList {
190+
/** The list of tools for approval. */
191+
@encodedName("application/json", "tool_names")
192+
toolNames: string[];
159193
}
160194

161195
/** Available query types for Azure AI Search tool. */

specification/ai/data-plane/Azure.AI.Agents/preview/2025-05-15-preview/azure-ai-agents.json

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4582,6 +4582,21 @@
45824582
]
45834583
}
45844584
},
4585+
"MCPApprovalPerTool": {
4586+
"type": "object",
4587+
"description": "Customized MCP approval object, listing tools requiring and not requiring approvals",
4588+
"properties": {
4589+
"never": {
4590+
"$ref": "#/definitions/MCPToolList",
4591+
"description": "The list of tools, not requiring approval."
4592+
},
4593+
"always": {
4594+
"$ref": "#/definitions/MCPToolList",
4595+
"description": "The list of tools, always requiring approval."
4596+
}
4597+
}
4598+
},
4599+
"MCPRequiredApproval": {},
45854600
"MCPToolDefinition": {
45864601
"type": "object",
45874602
"description": "The input definition information for a MCP tool which defines a MCP server endpoint",
@@ -4616,6 +4631,23 @@
46164631
],
46174632
"x-ms-discriminator-value": "mcp"
46184633
},
4634+
"MCPToolList": {
4635+
"type": "object",
4636+
"description": "The object, containing list of tools for approvals.",
4637+
"properties": {
4638+
"tool_names": {
4639+
"type": "array",
4640+
"description": "The list of tools for approval.",
4641+
"items": {
4642+
"type": "string"
4643+
},
4644+
"x-ms-client-name": "toolNames"
4645+
}
4646+
},
4647+
"required": [
4648+
"tool_names"
4649+
]
4650+
},
46194651
"MCPToolResource": {
46204652
"type": "object",
46214653
"description": "A set of resources that are used by the `mcp` tool.",
@@ -4633,15 +4665,8 @@
46334665
}
46344666
},
46354667
"require_approval": {
4636-
"type": "string",
4668+
"$ref": "#/definitions/MCPRequiredApproval",
46374669
"description": "Does MCP server require approval",
4638-
"enum": [
4639-
"never",
4640-
"always"
4641-
],
4642-
"x-ms-enum": {
4643-
"modelAsString": true
4644-
},
46454670
"x-ms-client-name": "requireApproval"
46464671
}
46474672
},
@@ -6591,11 +6616,11 @@
65916616
"index": {
65926617
"type": "integer",
65936618
"format": "int32",
6594-
"description": "The index of a response. *"
6619+
"description": "The index of a response."
65956620
},
65966621
"arguments": {
65976622
"type": "string",
6598-
"description": "The arguments for MCP call. *"
6623+
"description": "The arguments for MCP call."
65996624
}
66006625
},
66016626
"required": [

0 commit comments

Comments
 (0)