> ## Documentation Index
> Fetch the complete documentation index at: https://datagen.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Tools Reference

> Complete parameter reference for all DataGen MCP tools

## Code Execution

### executeCode

Execute Python code with MCP tool integration in a remote sandbox.

| Parameter            | Type      | Required | Default | Description                                                 |
| -------------------- | --------- | -------- | ------- | ----------------------------------------------------------- |
| `script`             | string    | Yes      | --      | Python code to execute                                      |
| `name`               | string    | No       | --      | Descriptive name for tracking                               |
| `description`        | string    | No       | --      | Brief description of what the code does                     |
| `session_id`         | string    | No       | --      | Session ID to group related executions                      |
| `input_vars`         | object    | No       | --      | Variables available in the script                           |
| `output_vars`        | object    | No       | --      | Expected output variables and types                         |
| `required_tools`     | string\[] | No       | --      | Required MCP tools (e.g., `["mcp_Supabase_list_projects"]`) |
| `additional_imports` | string\[] | No       | --      | PyPI packages to import (package names only)                |
| `local`              | boolean   | No       | --      | Run locally (true) or in E2B sandbox (false)                |
| `mcp_server_names`   | string\[] | No       | --      | MCP servers to spin up (reduces startup time)               |
| `timeout`            | number    | No       | 300     | Execution timeout in seconds (30-300)                       |
| `required_secrets`   | string\[] | No       | --      | Secret names to inject as Python variables                  |

**Notes:** Supports Python 3.12, synchronous code only. Use `httpx` for HTTP requests (not `requests`). Use `ThreadPoolExecutor` for I/O-bound workloads.

***

## Custom Tool Management

### createCustomTool

Deploy a Python workflow as a reusable API endpoint.

| Parameter            | Type                      | Required | Default     | Description                                          |
| -------------------- | ------------------------- | -------- | ----------- | ---------------------------------------------------- |
| `script`             | string                    | Yes      | --          | Python code to deploy                                |
| `deployment_name`    | string                    | Yes      | --          | API name (e.g., `sync_supabase_to_heyreach`)         |
| `description`        | string                    | Yes      | --          | What the custom tool does                            |
| `input_schema`       | object                    | No       | --          | OpenAPI/JSON Schema for input validation             |
| `output_variables`   | string\[]                 | No       | --          | Output variable names (e.g., `["result", "status"]`) |
| `required_tools`     | string\[]                 | No       | --          | Required MCP tools                                   |
| `additional_imports` | string\[]                 | No       | --          | Python packages (names only, no versions)            |
| `deployment_type`    | `"private"` \| `"public"` | No       | `"private"` | Visibility                                           |
| `is_code_public`     | boolean                   | No       | false       | Whether source code is visible when public           |
| `local`              | boolean                   | No       | --          | Run locally or in E2B sandbox                        |
| `mcp_server_names`   | string\[]                 | No       | --          | MCP server names for tools                           |
| `default_input_vars` | object                    | No       | --          | Default values for input variables                   |
| `required_secrets`   | string\[]                 | No       | --          | Secret names from secret management                  |

**Returns:** `deployment_uuid` on success.

### updateCustomTool

Update an existing custom tool. Only provided fields are updated.

| Parameter            | Type                      | Required | Default | Description                   |
| -------------------- | ------------------------- | -------- | ------- | ----------------------------- |
| `custom_tool_uuid`   | string                    | Yes      | --      | UUID of the tool to update    |
| `name`               | string                    | No       | --      | Updated name                  |
| `description`        | string                    | No       | --      | Updated description           |
| `final_code`         | string                    | No       | --      | Updated Python code           |
| `input_schema`       | object                    | No       | --      | Updated input schema          |
| `output_variables`   | string\[]                 | No       | --      | Updated output variable names |
| `default_input_vars` | object                    | No       | --      | Updated default input values  |
| `additional_imports` | string\[]                 | No       | --      | Updated Python imports        |
| `expected_tools`     | string\[]                 | No       | --      | Updated required MCP tools    |
| `required_secrets`   | string\[]                 | No       | --      | Updated required secrets      |
| `is_code_public`     | boolean                   | No       | --      | Toggle source code visibility |
| `deployment_type`    | `"private"` \| `"public"` | No       | --      | Toggle deployment visibility  |
| `mcp_server_names`   | string\[]                 | No       | --      | Updated MCP server names      |

### getCustomToolDetails

Get full specs, code, input examples, and curl commands for a custom tool.

| Parameter          | Type    | Required | Default | Description                                               |
| ------------------ | ------- | -------- | ------- | --------------------------------------------------------- |
| `custom_tool_uuid` | string  | Yes      | --      | UUID of the custom tool                                   |
| `brief`            | boolean | No       | false   | True for essential info only (name, description, schemas) |

### submitCustomToolRun

Execute a deployed custom tool asynchronously. Returns a `run_uuid` to monitor with `checkRunStatus`.

| Parameter          | Type   | Required | Default | Description                                                      |
| ------------------ | ------ | -------- | ------- | ---------------------------------------------------------------- |
| `custom_tool_uuid` | string | Yes      | --      | UUID of the custom tool to execute                               |
| `input_vars`       | object | No       | --      | Input data (e.g., `{"url": "https://example.com", "count": 10}`) |

### checkRunStatus

Monitor the progress and results of a custom tool run with automatic polling.

| Parameter               | Type   | Required | Default | Description                                  |
| ----------------------- | ------ | -------- | ------- | -------------------------------------------- |
| `run_uuid`              | string | No       | --      | Run UUID from `submitCustomToolRun`          |
| `custom_tool_uuid`      | string | No       | --      | Custom tool UUID to find the most recent run |
| `timeout_seconds`       | number | No       | 180     | Max wait time (max 600)                      |
| `poll_interval_seconds` | number | No       | 5       | Seconds between checks (2-30)                |

Provide either `run_uuid` or `custom_tool_uuid`.

***

## Tool Discovery & Execution

### searchTools

Find tools by functionality, keywords, or provider.

| Parameter  | Type   | Required | Default | Description                                      |
| ---------- | ------ | -------- | ------- | ------------------------------------------------ |
| `query`    | string | Yes      | --      | What you want to accomplish (e.g., "send email") |
| `provider` | string | No       | --      | Filter by provider (e.g., "Supabase", "GitHub")  |
| `limit`    | number | No       | 10      | Max results (1-100)                              |
| `offset`   | number | No       | 0       | Skip N results for pagination                    |

### getToolDetails

Get comprehensive documentation for a specific tool.

| Parameter   | Type   | Required | Default | Description                                        |
| ----------- | ------ | -------- | ------- | -------------------------------------------------- |
| `tool_name` | string | Yes      | --      | Exact tool name (e.g., `mcp_Supabase_execute_sql`) |

### executeTool

Execute any MCP or default tool by its alias name.

| Parameter         | Type   | Required | Default | Description                                         |
| ----------------- | ------ | -------- | ------- | --------------------------------------------------- |
| `tool_alias_name` | string | Yes      | --      | Tool alias (e.g., `mcp_github_search_repositories`) |
| `parameters`      | object | No       | --      | Parameters as key-value pairs                       |

***

## MCP Server Management

### addRemoteMcpServer

Connect an external MCP server. Supports template-based (with auto OAuth) or manual URL.

| Parameter     | Type   | Required | Default | Description                                                 |
| ------------- | ------ | -------- | ------- | ----------------------------------------------------------- |
| `template_id` | string | No       | --      | Template ID for pre-configured servers (e.g., `linear-mcp`) |
| `server_name` | string | No       | --      | Display name (CamelCase, e.g., `GoogleDrive`)               |
| `server_url`  | string | No       | --      | Server endpoint URL                                         |
| `credentials` | object | No       | --      | API keys/tokens required by the template                    |

Provide either `template_id` or `server_name` + `server_url`.

### searchBuiltInServers

Browse pre-configured MCP server templates.

| Parameter | Type   | Required | Default | Description                                 |
| --------- | ------ | -------- | ------- | ------------------------------------------- |
| `name`    | string | No       | --      | Filter by name (case-insensitive substring) |

### getBuiltInServerDetails

Get full configuration details for a built-in server template.

| Parameter     | Type   | Required | Default | Description                             |
| ------------- | ------ | -------- | ------- | --------------------------------------- |
| `template_id` | string | Yes      | --      | Template ID from `searchBuiltInServers` |

### checkRemoteMcpOauthStatus

Poll for OAuth completion after receiving an auth URL from `addRemoteMcpServer`.

| Parameter         | Type   | Required | Default | Description                             |
| ----------------- | ------ | -------- | ------- | --------------------------------------- |
| `flow_id`         | string | Yes      | --      | OAuth flow ID from `addRemoteMcpServer` |
| `timeout_seconds` | number | No       | 120     | Max wait time (max 300)                 |

### ReAuthRemoteMcpServer

Reauthenticate an existing MCP server with expired OAuth tokens.

| Parameter     | Type   | Required | Default | Description                             |
| ------------- | ------ | -------- | ------- | --------------------------------------- |
| `server_name` | string | Yes      | --      | Server name (CamelCase, e.g., `GitHub`) |

### updateRemoteMcpServer

Update an existing MCP server's URL and credentials.

| Parameter     | Type   | Required | Default | Description                          |
| ------------- | ------ | -------- | ------- | ------------------------------------ |
| `server_name` | string | Yes      | --      | Server name (CamelCase)              |
| `server_url`  | string | Yes      | --      | New endpoint URL                     |
| `env_args`    | object | Yes      | --      | Updated environment variables/config |

***

## Utilities

### datagen-sdk-doc

Fetch the DataGen Python SDK documentation from GitHub. Returns the README content without images.

**Parameters:** None
