Reference for ARIA MCP tool coding patterns, conventions, and architecture. Use when creating, modifying, or reviewing tools.
This is background knowledge about how ARIA MCP tools are structured. Apply these patterns when creating, modifying, or reviewing tools.
Every tool file in ARIA/agent/tools/ must follow this structure:
"""Module docstring — one-line purpose."""
from __future__ import annotations
from claude_agent_sdk import tool
from agent.observability import get_tracer
tracer = get_tracer()
@tool(
name="tool_name",
description="Detailed description for Claude to know when/how to use this tool.",
input_schema={"param": type},
)
async def tool_function(args: dict) -> dict:
"""Function docstring."""
with tracer.start_as_current_span("module.operation") as span:
param = args.get("param", default)
span.set_attribute("aria.domain.param", param)
# Logic here
result = {}
span.set_attribute("aria.domain.output", value)
return {"content": [{"type": "text", "text": str(result)}]}
<module>.<operation> — e.g., risk_engine.run_checksaria.<domain>.<field> — e.g., aria.trade.sell_tokenget_price_spreadmcp__aria__<tool_name> in allowed_toolsAfter creating a tool, it must be registered in ARIA/agent/aria_agent.py:
_build_tool_server() tools listmcp__aria__<name> to allowed_tools in _build_options()If a tool introduces constraints:
RejectionReason enum valuerun_risk_checks()ARIA_SYSTEM_PROMPT rulesTools access config via AriaConfig from agent.config. Sub-configs:
TradingConfig — strategy params (no prefix)Web3Config — Ethereum/addresses (no prefix)IPFSConfig — Pinata (prefix: PINATA_)OtelConfig — telemetry (prefix: OTEL_)