Skip to main content

Tool Spec Format Reference

The Tool Spec is the intermediate YAML format that sits between your source material and the generated TypeScript. Every generation path — OpenAPI, natural language — produces a Tool Spec. You can also write one by hand. Forge validates every Tool Spec against a Zod schema before generation. Invalid specs produce clear error messages pointing to the offending field.

Complete Annotated Example

Top-Level Fields

Tool Definition

Each entry in the tools array defines one agent capability.

When to use params vs body

  • params — fields sent as URL query parameters or interpolated into the path.
  • body — fields sent in the JSON request body.
For GET and DELETE, use params. For POST, PUT, and PATCH, use body for the payload and params for path/query parameters.

Field Definition

Each entry in params or body is a FieldDef:

Array fields

Nested object fields

Auth Configuration

bearer

Generated code adds Authorization: Bearer ${process.env.ZENDESK_API_TOKEN} to requests.

api_key

Generated code adds the custom header with the value from the env var.

basic

Forge assumes a companion JIRA_PASSWORD env var (the env value with _USERNAME replaced by _PASSWORD). Generated code encodes them as Basic base64(user:pass).

oauth2

Forge assumes companion env vars: SLACK_CLIENT_SECRET, SLACK_TOKEN_URL, SLACK_REDIRECT_URI. The generated code includes a token refresh flow.

none

No auth headers are added.

Trigger Definitions

Triggers define how external events invoke agent capabilities.

webhook

schedule

emit

queue

file

Validation

Forge validates the Tool Spec against a Zod schema before generating code. Common validation errors:
Validate a spec without generating:
Programmatic validation: