Skip to main content

Defining Tools in the UI

Four input methods:
  • Upload JSON.json files containing tool definitions (single tool or array).
  • Upload OpenAPI Spec.json, .yaml, or .yml files in OpenAPI 3.x format. Operations are extracted as individual tools.
  • Paste JSON — paste tool definitions directly.
  • Natural Language — describe tools in plain English; the teacher model compiles these into structured schemas.
Built-in example sets are available: general-purpose (Data Retrieval, Actions & Mutations, Computation & Analysis) and domain-specific (CRM, Support Desk, E-Commerce).

OpenAPI Spec Format

Upload a standard OpenAPI 3.x spec and Spectra extracts each operation as a tool:
Accepts .json, .yaml, and .yml files.

JSON Schema Format

Each tool is defined as a JSON object with a name, description, and parameter schema:
During training, Spectra normalizes uploaded JSON schemas and natural-language tool descriptions into the same canonical tool definition before seed generation and reward compilation. In practice, that means your final tool name is normalized to snake_case, and the model is trained against typed parameters plus explicit required fields rather than against the raw prose description.

Natural Language Format

Clear and detailed:
Concise but complete:

Tips for Natural Language Schemas

  • Be specific about parameters — include names, types, and constraints
  • Specify constraints — formats (LD-XXXX), enums (New, Contacted, Qualified), ranges (1-10), lengths (max 280 chars)
  • Indicate required vs optional — explicitly state which parameters are required
  • One tool per description — describe a single tool per natural language entry
Natural-language tools are convenient, but they still have to compile into a typed schema before training starts. If you need deterministic parameter names, strict enums, or exact patterns, use JSON or generate the schema in the UI and review it before training.

Pipeline Schema Methods

When using the mechanex-train CLI or Cloud Run Jobs directly, tool schemas can be provided in several ways:

Environment Variable

Use TOOL_SCHEMAS_TEXT with pipe-separated descriptions:

Text File

Create a file with one schema per line:
Then reference it:

Config File

JSON Schema Directory

Place individual .json files in a directory:

Mixing Methods

All methods can be combined. The pipeline merges schemas from all sources:

JSON vs Natural Language

Natural language schemas cost slightly more to process since the teacher model interprets the description during reward compilation. The difference is minimal (approximately $0.001 per schema).