CopilotWebSearchFunction
NexusLabs.Needlr.Copilot¶
CopilotWebSearchFunction Class¶
Microsoft.Extensions.AI.AIFunction that calls the Copilot MCP server's web_search tool.
Returns a WebSearchResult containing the answer text, source
citations, and the search queries that were performed.
Inheritance System.Object 🡒 Microsoft.Extensions.AI.AITool 🡒 Microsoft.Extensions.AI.AIFunctionDeclaration 🡒 Microsoft.Extensions.AI.AIFunction 🡒 CopilotWebSearchFunction
Example¶
var tools = CopilotToolSet.Create(new CopilotToolSetOptions { EnableWebSearch = true });
// Pass tools to an agent via IterativeLoopOptions.Tools
Properties¶
CopilotWebSearchFunction.Description Property¶
Gets a description of the tool, suitable for use in describing the purpose to a model.
Property Value¶
CopilotWebSearchFunction.JsonSchema Property¶
Gets a JSON Schema describing the function and its input parameters.
Property Value¶
Remarks¶
When specified, declares a self-contained JSON schema document that describes the function and its input parameters. A simple example of a JSON schema for a function that adds two numbers together is shown below:
{
"type": "object",
"properties": {
"a" : { "type": "number" },
"b" : { "type": ["number","null"], "default": 1 }
},
"required" : ["a"]
}
The metadata present in the schema document plays an important role in guiding AI function invocation.
When an Microsoft.Extensions.AI.AIFunction is created via Microsoft.Extensions.AI.AIFunctionFactory, this schema is automatically derived from the method's parameters using the configured System.Text.Json.JsonSerializerOptions and Microsoft.Extensions.AI.AIJsonSchemaCreateOptions.
When no schema is specified, consuming chat clients should assume the "{}" or "true" schema, indicating that any JSON input is admissible.
CopilotWebSearchFunction.Name Property¶
Gets the name of the tool.