Skip to main content

Tool Execution

CTP defines three execution modes that determine where and how tools run.

Execution Modes

Client Mode (Default)

Tools execute entirely in the browser using Web APIs.
Advantages:
  • No server required
  • Complete privacy (data stays in browser)
  • No latency from network requests
  • Works offline
Limitations:
  • No access to filesystem
  • No server-side secrets
  • Browser API limitations

Server Mode

Tools require server-side execution.
Use Cases:
  • File system operations
  • Database access
  • External API calls requiring secrets
  • Heavy computation

Hybrid Mode

Tools can execute in either environment with compatible implementations.

Tool Function Signature

Synchronous vs Asynchronous

Synchronous Tools

Asynchronous Tools

Runtime Behavior

Tool Registry

Execution Runtime

Timeout Handling

Abort Support

Parallel Execution

Error Handling

Always handle both success and failure cases: