EchoStash
Docs

Tool Definitions

Define function-calling tools directly in your prompt template

Tool Definitions

Define function-calling tools directly in your Echo DSL template using [#TOOL] blocks. Tools are rendered in OpenAI function-calling format and included in the renderMessages() output.

Basic Syntax

tool-basic.echo
[#TOOL get_weather]
description: Get current weather for a city
parameters:
  city:
    type: string
    description: City name
    required: true
  units:
    type: string
    description: Temperature units
    enum: [celsius, fahrenheit]
[END TOOL]

Multiple Tools

travel-tools.echo
[#ROLE system]
You are a travel assistant. Use the available tools to help plan trips.
[END ROLE]

[#TOOL search_flights]
description: Search for available flights
parameters:
  origin:
    type: string
    description: Departure airport code
    required: true
  destination:
    type: string
    description: Arrival airport code
    required: true
  date:
    type: string
    description: Travel date (YYYY-MM-DD)
    required: true
[END TOOL]

[#TOOL get_hotel_prices]
description: Get hotel prices for a destination
parameters:
  city:
    type: string
    description: City name
    required: true
  checkin:
    type: string
    description: Check-in date
    required: true
  checkout:
    type: string
    description: Check-out date
    required: true
[END TOOL]

[#ROLE user]
I want to travel from {{origin}} to {{destination}} on {{date}}.
[END ROLE]

Conditional Tools

Wrap tool definitions in conditionals to include them only when needed:

conditional-tool.echo
[#IF {{tier}} #equals(premium)]
[#TOOL priority_support]
description: Escalate to priority support queue
parameters:
  urgency:
    type: string
    enum: [high, critical]
    required: true
[END TOOL]
[END IF]

Tool Output Format

Tools are rendered in OpenAI function-calling format:

json
{
  "type": "function",
  "function": {
    "name": "get_weather",
    "description": "Get current weather for a city",
    "parameters": {
      "type": "object",
      "properties": {
        "city": { "type": "string", "description": "City name" }
      },
      "required": ["city"]
    }
  }
}

Supported Parameter Types

Supported types: string, number, boolean, array, object. Each parameter supports type, description, required, enum, default, and items.