FoundryToolFactory.Create Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| Create(FoundryTool) |
Creates a FoundryTool from a FoundryTool instance (passthrough). |
| Create(IDictionary<String,Object>) |
Creates a FoundryTool from a dictionary-based facade with a "type" discriminator field. |
| Create(Object) |
Creates a FoundryTool from an object input. Dispatches to the appropriate overload based on the runtime type. |
Create(FoundryTool)
- Source:
- FoundryToolFactory.cs
Creates a FoundryTool from a FoundryTool instance (passthrough).
public static Azure.AI.AgentServer.Core.Tools.Models.FoundryTool Create(Azure.AI.AgentServer.Core.Tools.Models.FoundryTool tool);
static member Create : Azure.AI.AgentServer.Core.Tools.Models.FoundryTool -> Azure.AI.AgentServer.Core.Tools.Models.FoundryTool
Public Shared Function Create (tool As FoundryTool) As FoundryTool
Parameters
- tool
- FoundryTool
The FoundryTool instance.
Returns
The same FoundryTool instance.
Exceptions
Thrown when tool is null.
Applies to
Create(IDictionary<String,Object>)
- Source:
- FoundryToolFactory.cs
Creates a FoundryTool from a dictionary-based facade with a "type" discriminator field.
public static Azure.AI.AgentServer.Core.Tools.Models.FoundryTool Create(System.Collections.Generic.IDictionary<string,object?> facade);
static member Create : System.Collections.Generic.IDictionary<string, obj> -> Azure.AI.AgentServer.Core.Tools.Models.FoundryTool
Public Shared Function Create (facade As IDictionary(Of String, Object)) As FoundryTool
Parameters
- facade
- IDictionary<String,Object>
A dictionary containing tool definition with required "type" field. The "type" field can be:
- A protocol name (e.g., "MCP", "A2A") - creates a FoundryConnectedTool (requires "project_connection_id")
- A custom string - creates a FoundryHostedMcpTool with the string as the tool name
Returns
A strongly-typed FoundryTool instance:
- FoundryConnectedTool if type matches a known protocol
- FoundryHostedMcpTool for custom tool names
Exceptions
Thrown when facade is null.
Thrown when:
- The facade is missing the required "type" field
- The "type" field is not a string or is empty
- A protocol type is used but "project_connection_id" is missing or empty
Applies to
Create(Object)
- Source:
- FoundryToolFactory.cs
Creates a FoundryTool from an object input. Dispatches to the appropriate overload based on the runtime type.
public static Azure.AI.AgentServer.Core.Tools.Models.FoundryTool Create(object tool);
static member Create : obj -> Azure.AI.AgentServer.Core.Tools.Models.FoundryTool
Public Shared Function Create (tool As Object) As FoundryTool
Parameters
- tool
- Object
The tool input, which can be:
- A FoundryTool instance (returned as-is)
- A dictionary with a "type" discriminator field
Returns
A strongly-typed FoundryTool instance.
Exceptions
Thrown when tool is null.
Thrown when the tool type is not supported or format is invalid.