Tool Registry
The agent runtime uses an MCP-first, API-fallback architecture. External data sources are accessed through Model Context Protocol (MCP) servers when available, with custom API wrappers as internal tools for everything else. All tool I/O passes through the AI Firewall.
Architecture
Company Runtime
│
├── ToolRegistry (central dispatcher)
│ ├── Internal tools (43 registered)
│ └── MCP tools (auto-discovered)
│
└── MCPClientHub
├── Hyperliquid MCP (~27 tools)
├── Hive Intel MCP (351 tools)
├── EVM MCP (22 tools)
└── DeFi Trading MCP (25+ tools)MCP Servers
Four MCP servers are configured in the MCPClientHub. Each server is tagged with the
categories it serves:
| Server | Package | Transport | Tools | Categories |
|---|---|---|---|---|
| Hyperliquid | @hyperliquid-ai/mcp-server | stdio | ~27 | DERIVATIVES, SPOT_TRADING |
| Hive Intel | mcp-hive | stdio | 351 | All 7 categories |
| EVM | @mcpdotdirect/evm-mcp-server | stdio | 22 | DEFI_YIELD, SPOT_TRADING, MULTICHAIN, RWA |
| DeFi Trading | defi-trading-mcp | stdio | 25+ | SPOT_TRADING, DEFI_YIELD, MULTICHAIN |
When the runtime boots, MCPClientHub.initialize(companyCategory) filters to only the servers
relevant to that company’s category and connects via the MCP SDK:
const relevantServers = MCP_SERVERS.filter((s) =>
s.categories.includes(companyCategory),
);Each MCP tool is assigned a prefix to prevent name collisions: hl_ for Hyperliquid, hive_
for Hive Intel, evm_ for EVM, and dex_ for DeFi Trading.
ToolDefinition Interface
Every tool — internal or MCP-bridged — implements the ToolDefinition interface:
interface ToolDefinition {
id: string; // Unique tool ID (OpenAI function name)
name: string; // Human-readable display name
description: string; // LLM instruction for when to use
category: ToolCategory;
tier: ToolTier;
costMicroUsdc: bigint; // Cost per call in micro-USDC
parameters: ToolParameters; // JSON Schema (OpenAI format)
execute: (params, context?) => Promise<unknown>;
timeoutMs?: number; // Default: 30,000ms
}Tool Categories
Tools are organized into 5 functional categories. Agents only receive tools matching their allowed skill categories:
| Category | ID | Description |
|---|---|---|
| Market Data | market-data | Price feeds, TVL, trending tokens, yield pools |
| Social | social | X/Twitter search, sentiment, KOL monitoring |
| Chain | chain | Wallet balances, gas prices, contract verification |
| Compute | compute | AI compute, image generation, model inference |
| Service | service | A2A skill marketplace (discover, purchase, track) |
Tool Tiers
Each tool has a pricing tier that determines access level and cost:
| Tier | Cost Range | Description |
|---|---|---|
FREE | 0 micro-USDC | Public APIs, cached data (CoinGecko, DefiLlama) |
STANDARD | 1,000-5,000 micro-USDC | Rate-limited APIs, social data, MCP calls |
PREMIUM | 10,000+ micro-USDC | AI compute, proprietary data feeds |
MCP tools default to STANDARD tier at 5,000 micro-USDC ($0.005) per call.
Internal Tools (43)
The tool-implementations.ts file registers 43+ internal tools across all categories:
Market Data
| Tool ID | Description |
|---|---|
get_token_price | CoinGecko token price lookup |
get_trending_tokens | CoinGecko trending tokens |
get_token_market_chart | Historical price charts |
get_top_markets | Top tokens by market cap |
get_token_metadata | Token metadata and links |
defi_tvl_overview | DefiLlama TVL overview |
defi_base_protocols | Base chain protocol rankings |
defi_yield_pools | DeFi yield pool scanner |
defi_protocol_fees | Protocol fee revenue data |
dex_token_search | DEX token search (DexScreener) |
dex_base_trending | Trending tokens on Base DEXs |
dune_query | Dune Analytics query execution |
dune_base_daily_tx | Base daily transaction stats |
hyperliquid_markets | Hyperliquid perp market data |
polymarket_trending | Polymarket trending markets |
polymarket_search | Polymarket search |
crypto_fear_greed | Fear & Greed Index |
binance_funding_rate | Binance funding rates |
binance_open_interest | Binance open interest |
binance_long_short_ratio | Long/short ratio data |
dydx_perp_markets | dYdX perpetual markets |
dydx_funding_rates | dYdX funding rates |
dexpaprika_token_price | DexPaprika token prices |
dexpaprika_top_pools | DexPaprika top pools |
dexpaprika_ohlcv | DexPaprika OHLCV candles |
Social
| Tool ID | Description |
|---|---|
x_search_posts | X/Twitter post search |
x_user_timeline | X user timeline (KOL monitoring) |
x_trending_crypto | X crypto trending topics |
x_get_post | Fetch single X post |
x_user_info | X user profile info |
x_crypto_sentiment | Crypto sentiment analysis |
Chain
| Tool ID | Description |
|---|---|
get_wallet_balance | CDP wallet balance |
get_base_block_number | Current Base block number |
basescan_balance | BaseScan address balance |
basescan_transactions | BaseScan transaction history |
basescan_gas_price | BaseScan gas oracle |
basescan_contract_verified | Contract verification status |
blockscout_chain_stats | Blockscout chain statistics |
blockscout_address | Blockscout address info |
blockscout_token | Blockscout token info |
Security
| Tool ID | Description |
|---|---|
goplus_token_security | GoPlus token security check |
goplus_address_security | GoPlus address risk scoring |
goplus_approval_security | GoPlus approval risk check |
honeypot_check | Honeypot token detector |
Service (A2A)
| Tool ID | Description |
|---|---|
discover_services | Browse the A2A skill marketplace |
purchase_service | Purchase a service from another company’s agent |
check_service_job | Check status of a purchased service job |
AI Firewall
All tool inputs and outputs pass through the 3-layer AI Firewall (sanitizeContent()):
- Pattern matching — 32 regex patterns detect prompt injection attempts
- Content classification — classifies input as safe/suspicious/malicious
- Output sanitization — strips potentially harmful content from tool responses
The firewall runs in under 1ms and is applied to every ToolRegistry.executeTool() call.
MCP Caching
MCP tool responses are cached in ScrapeCache with tool-specific TTLs:
| Tool prefix | Cache TTL |
|---|---|
hl_market_data | 30s |
hl_orderbook | 10s |
hl_funding_rates | 5min |
hive_whale_alerts | 60s |
hive_token_holders | 1hr |
evm_transaction | never cached |
dex_swap | never cached |
| Default | 60s |
Timeout Protection
Every tool execution is wrapped in a timeout (default 30 seconds). If a tool exceeds its
timeoutMs, the call is rejected and the error is logged:
const { result, durationMs } = await registry.executeTool(
'defi_yield_pools',
{ chain: 'base', minApy: 5 },
agentContext,
);Category-Aware Loading
The full tool loading sequence during runtime initialization:
registerDefaultTools()— register all 43+ internal toolsinitializeMCP(companyCategory)— connect category-relevant MCP servers- MCP tools auto-discovered via
listTools()and bridged intoToolRegistry getToolsForAgent(allowedCategories)— filter by agent’s skill categoriestoOpenAITools(tools)— convert to OpenAI function calling format for LLM