Core concepts
Tools
Everything an agent can do becomes a schema-carrying Tool and registers into the gateway — so MCP servers, REST APIs, Skills, and RAG are all governed, audited, and argument-validated identically.
The Tool model
A Tool has a name, description, JSON-Schema parameters, and an invoke callable.
tools.py
from antraft import ToolRegistry, tool_from_function def multiply(a: float, b: float) -> float: "Multiply two numbers." return a * b tools = ToolRegistry([tool_from_function(multiply)])# schema (incl. required + closed additionalProperties) is inferred from hintsMCP — local and remote
mcp.py
from antraft import tools_from_mcp_stdio, tools_from_mcp_http # local MCP server over stdiotools.extend(tools_from_mcp_stdio("npx", ["-y", "@modelcontextprotocol/server-github"])) # remote MCP server over streamable HTTP (or SSE)tools.extend(tools_from_mcp_http("https://my-mcp.example.com/mcp"))REST / OpenAPI
rest.py
from antraft import rest_tool, tools_from_openapi tools.add(rest_tool("get_user", "GET", "https://api.example.com/users/{id}", description="Fetch a user")) tools.extend(tools_from_openapi(openapi_spec_dict)) # one Tool per operationAnthropic Skills & RAG
more.py
from antraft import tools_from_skills_dir, retriever_tool, InMemoryRetriever tools.extend(tools_from_skills_dir("./skills")) r = InMemoryRetriever().add(["doc one", "doc two"])tools.add(retriever_tool(r, k=4)) # RAG, governed like any toolNote
Whatever the source, every tool registers into the
ToolGateway, so it inherits argument validation, RBAC, retries/timeouts, and the audit trail with zero extra code.Schema validation
The gateway validates an action's arguments against the tool's JSON Schema before execution. Missing, mistyped, or unexpected arguments are rejected — a malformed or abusive call never runs.