Skip to main content

Structure

Basic Usage

Tools can be used in three main ways:
Each tool can be configured using the config property and environment variables:

Inline Definitions

Tools can be defined inline using either TypeScript or Python code directly in your workflow. Each tool must export a run() function that contains the tool’s logic.

Deno Modules

You can use Deno modules in your tool’s TypeScript code:

Schema Definition

When creating a tool, you define three types of schemas:
1

Configuration Schema

Defines the structure of the config object
2

Input Schema

Defines the structure of runtime parameters (used with with)
3

Output Schema

Defines the structure of the tool’s output
Here’s an example of a tool definition:
This tool can then be used like this:

Key Points

Configuration Schema

The config schema defines persistent configuration options that are set when the tool is initialized.

Input & Output Schema

The input and output schemas define runtime parameters and the tool’s output.

Schema Format

Both configuration and input schemas use JSON Schema for validation and documentation.

Run Function Parameters

The run() function receives both input and config parameters during execution.

Required Fields

Required fields must be specified in the respective required arrays within each schema definition.

Best Practices

Tool Organization

  • Use clear, descriptive tool IDs
  • Group related tools together
  • Document tool-specific configuration

Configuration Management

  • Use environment variables for sensitive data
  • Set sensible defaults in tool definitions
  • Override only necessary config at usage points

Error Handling

  • Always check tool error outputs
  • Provide fallback behavior where appropriate
  • Log tool execution metadata for debugging

Security

  • Never expose sensitive credentials in tool code
  • Validate and sanitize all inputs
  • Follow security best practices for external services

References