MCP
Tool Adapters
Adapt MCP tools into Anvia tool definitions.
MCP tools are adapted automatically by connectMcp(...).
What Gets Adapted
An MCP tool definition:
{
name: "search_docs",
description: "Search documentation.",
inputSchema: {
type: "object",
properties: {
query: { type: "string" }
},
required: ["query"]
}
}becomes an Anvia tool definition:
{
name: "search_docs",
description: "Search documentation.",
parameters: {
type: "object",
properties: {
query: { type: "string" }
},
required: ["query"]
}
}The MCP inputSchema is passed through as the provider-facing parameters.
Calls
When the adapted tool is called, Anvia sends the MCP server:
{
name: "search_docs",
arguments: {
query: "agent history"
}
}Arguments must be a JSON object. Non-object arguments are rejected before the MCP call.
When You Need a Local Adapter
If you want to rename, filter, or wrap MCP behavior, create a normal Anvia tool that calls your MCP server or service.
const searchInternalDocs = createTool({
name: "search_internal_docs",
description: "Search internal support documentation.",
input: z.object({ query: z.string() }),
async execute({ query }) {
return docsServer.tools
.find((tool) => tool.name === "search_docs")
?.call({ query });
},
});Prefer the automatic adapter unless you need product-specific names, filtering, auditing, or permissions.
