Skip to content

AgentPrismClientToolExtensions

Namespace AgentPrism · Assembly AgentPrism.Core.dll

Registers a client-side tool: its declaration (name, description, JSON schema) lives in code, like every other tool (the code-only tools rule), but its body runs on the caller instead of on the server.

public static class AgentPrismClientToolExtensions

objectAgentPrismClientToolExtensions

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

AddClientTool(IAgentPrismBuilder, string, string, JsonElement)

Section titled “ AddClientTool(IAgentPrismBuilder, string, string, JsonElement)”

Registers a tool whose body the server never runs.

public static IAgentPrismBuilder AddClientTool(this IAgentPrismBuilder builder, string name, string description, JsonElement jsonSchema)

builder IAgentPrismBuilder

The AgentPrism configuration chain.

name string

The tool name. Must be unique among all registered tools.

description string

The description that lets the model understand when to call the tool.

jsonSchema JsonElement

The arguments’ JSON schema.

IAgentPrismBuilder

The chain, for further configuration.

The model can call the tool, but the server produces a FunctionCallContent and returns it to the caller instead of running anything — Microsoft Agent Framework’s FunctionInvokingChatClient only invokes an AIFunction; a declaration-only AIFunctionDeclaration is not one. The caller (typically a browser) runs the tool itself and sends the result back via AgentRunRequest.ToolResults (AgentPrism.AspNetCore) to let the turn continue.

A client-side tool cannot require approval — there is no server-side body to defer. ToolRegistry rejects that combination at startup if attempted through a direct AgentPrismToolRegistration registration.

var schema = JsonSerializer.Deserialize<JsonElement>(
"""{"type":"object","properties":{"path":{"type":"string"}}}""");
builder.AddAgentPrism()
.AddClientTool("open_page", "Opens a page in the user's browser.", schema);

ArgumentNullException

builder is null.

ArgumentException

name or description is empty.