Skip to main content
Code mode lets you write local scripts that call MCP tools through the DataGen SDK. Use it when you need batch processing, complex logic, or production-grade automation that goes beyond interactive MCP tool calls.
Using Claude Code? Run /datagen:code-mode for guided scripting with tool discovery, durable checkpoint patterns, and large output handling.

When to Use Code Mode

Use MCP Tools When

  • Interactive discovery and debugging
  • Simple one-off operations
  • Learning tool schemas
  • AI agent-assisted work

Use Code Mode When

  • Batch processing (100+ operations)
  • Scheduled jobs and cron tasks
  • CI/CD pipelines
  • Complex data transformations
  • Production applications
Rule of thumb: fewer than 5 tool calls with small results — use MCP directly. More than 5 calls, large data, or complex logic — write a script with the SDK.

Installation

Set your API key:

Quick Start


Patterns

Simple Script

One-off data operations:

Batch Processing with Error Handling

Process large datasets with retry logic:

Deploy as Custom Tool

Turn your script into a deployed API endpoint:

Error Handling


Full API Reference

For complete method signatures, parameters, and return types, see:

Python SDK Reference

Every method, every parameter

TypeScript SDK Reference

Every method, every parameter