Class Tool
Tool details of a tool that the model may use to generate a response.
public record Tool : IEquatable<Tool>
- Inheritance
-
Tool
- Implements
- Inherited Members
Properties
CodeExecution
Optional. CodeExecution tool type. Enables the model to execute code as part of generation.
[JsonPropertyName("codeExecution")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ToolCodeExecution? CodeExecution { get; set; }
Property Value
ComputerUse
Optional. Tool to support the model interacting directly with the computer. If enabled, it automatically populates computer-use specific Function Declarations.
[JsonPropertyName("computerUse")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ComputerUse? ComputerUse { get; set; }
Property Value
EnterpriseWebSearch
Optional. Tool to support searching public web data, powered by Vertex AI Search and Sec4 compliance. This field is not supported in Gemini API.
[JsonPropertyName("enterpriseWebSearch")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public EnterpriseWebSearch? EnterpriseWebSearch { get; set; }
Property Value
FileSearch
Optional. FileSearch tool type. Tool to retrieve knowledge from Semantic Retrieval corpora. This field is not supported in Vertex AI.
[JsonPropertyName("fileSearch")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public FileSearch? FileSearch { get; set; }
Property Value
FunctionDeclarations
Optional. Function tool type. One or more function declarations to be passed to the model along with the current user query. Model may decide to call a subset of these functions by populating FunctionCall in the response. User should provide a FunctionResponse for each function call in the next turn. Based on the function responses, Model will generate the final response back to the user. Maximum 512 function declarations can be provided.
[JsonPropertyName("functionDeclarations")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<FunctionDeclaration>? FunctionDeclarations { get; set; }
Property Value
GoogleMaps
Optional. Tool that allows grounding the model's response with geospatial context related to the user's query.
[JsonPropertyName("googleMaps")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public GoogleMaps? GoogleMaps { get; set; }
Property Value
GoogleSearch
Optional. GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google.
[JsonPropertyName("googleSearch")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public GoogleSearch? GoogleSearch { get; set; }
Property Value
GoogleSearchRetrieval
Optional. Specialized retrieval tool that is powered by Google Search.
[JsonPropertyName("googleSearchRetrieval")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public GoogleSearchRetrieval? GoogleSearchRetrieval { get; set; }
Property Value
McpServers
Optional. MCP Servers to connect to. This field is not supported in Vertex AI.
[JsonPropertyName("mcpServers")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<McpServer>? McpServers { get; set; }
Property Value
ParallelAiSearch
Optional. If specified, Vertex AI will use Parallel.ai to search for information to answer user queries. The search results will be grounded on Parallel.ai and presented to the model for response generation. This field is not supported in Gemini API.
[JsonPropertyName("parallelAiSearch")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ToolParallelAiSearch? ParallelAiSearch { get; set; }
Property Value
Retrieval
Optional. Retrieval tool type. System will always execute the provided retrieval tool(s) to get external knowledge to answer the prompt. Retrieval results are presented to the model for generation. This field is not supported in Gemini API.
[JsonPropertyName("retrieval")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Retrieval? Retrieval { get; set; }
Property Value
UrlContext
Optional. Tool to support URL context retrieval.
[JsonPropertyName("urlContext")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public UrlContext? UrlContext { get; set; }
Property Value
Methods
FromJson(string, JsonSerializerOptions?)
Deserializes a JSON string to a Tool object.
public static Tool? FromJson(string jsonString, JsonSerializerOptions? options = null)
Parameters
jsonStringstringThe JSON string to deserialize.
optionsJsonSerializerOptionsOptional JsonSerializerOptions.
Returns
- Tool
The deserialized Tool object, or null if deserialization fails.