Skip to main content

Quick Start


GatewayClient

Methods

method
List available MCP tools. Results are cached.
Returns: list[Tool]
method
Get a specific tool definition.
Returns: Tool
method
Semantic search for tools.
Returns: list[SearchResult]
method
Invoke a tool.
Returns: ToolResult
method
Invoke via raw MCP JSON-RPC 2.0 protocol.
method
Register tools from an OpenAPI specification.
Returns: list[str] (tool names)

Decorators

@mcp_tool

Route a function call through the MCP Gateway:

@discover_tools

Auto-bind gateway tools as class methods:

Tool Types


How It Works

1

Agent calls call_tool()

Your agent calls call_tool("brave_web_search", {query: "..."}) via the Gateway SDK.
2

Gateway looks up tool definition

The Gateway resolves the tool name to its registered definition and validates the arguments against the parameter schema.
3

Fetch credentials from Vault

The Gateway requests the API key for Brave Search from Hexr Vault (SPIFFE-authenticated).
4

Proxy request to external API

The Gateway sends GET /search?q=... to the Brave API with the injected API key header.
5

Return structured result

Search results are returned to the agent as ToolResult(success=true, result=...).
The Gateway:
  1. Validates arguments against the tool’s parameter schema
  2. Injects credentials from Hexr Vault (no API keys in your code)
  3. Proxies the HTTP request to the external API
  4. Returns the result as a structured ToolResult

Pre-Loaded Tools

The Gateway ships with tools from 3 embedded OpenAPI specs: Register additional tools by importing OpenAPI specs: