McpToolRegistry
AgentPrism.Mcp.dllA registry that combines tools registered in code with those discovered from remote MCP servers.
public sealed class McpToolRegistry : IToolRegistryInheritance
Section titled “Inheritance”Implements
Section titled “Implements”Inherited Members
Section titled “Inherited Members”object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”Code always wins. An MCP tool with the same name can never replace a tool registered in code. Otherwise, a remote server could take over a local tool’s name and silently hijack the agent’s behavior. This is a natural extension of the code-only tools rule.
MCP tools are resolved per tenant: servers are registered per tenant, and a tool coming from one tenant’s server is not visible to another tenant.
Methods
Section titled “Methods”List()
Section titled “ List()”Returns the definitions of all registered tools, ordered by name.
public IReadOnlyList<ToolDescriptor> List()Returns
Section titled “Returns”The tool definitions.
TryGet(string, out AIFunctionDeclaration?)
Section titled “ TryGet(string, out AIFunctionDeclaration?)”Fetches the tool with the given name.
public bool TryGet(string name, out AIFunctionDeclaration? tool)Parameters
Section titled “Parameters”name string
The tool name. Comparison is case-sensitive.
tool AIFunctionDeclaration?
The tool found.
Returns
Section titled “Returns”true if the tool is registered.
Remarks
Section titled “Remarks”The result is an AI.AIFunctionDeclaration, not an
AI.AIFunction: a client-side tool (AddClientTool) is
registered as a declaration-only AIFunctionDeclaration, which
is not an AI.AIFunction and cannot be invoked. Every
registered tool — server-side or client-side — is an
AI.AIFunctionDeclaration, so AIFunctionDeclaration.JsonSchema
is always available. Callers pass the result straight to
ChatOptions.Tools, which accepts the broader AITool.