Datatape
Tools

HTTP Tools

Wrap REST APIs as MCP tools with templated paths, headers, and request bodies.

HTTP Tools

HTTP tools let you expose REST API endpoints as MCP tools. Instead of writing SQL, you configure an HTTP request template that Datatape executes against an HTTP source.

How It Works

  1. Connect an HTTP source with a base URL and authentication credentials
  2. Create a tool with tool_type: http
  3. Define the request path, method, query parameters, headers, and body
  4. Add parameters that AI agents provide at call time

Datatape renders the request template with the provided parameters, executes it against the source, and returns the response.

Http Tool Config

Configuration

HTTP Method

Choose GET or POST depending on the API you are wrapping.

MethodUse Case
GETFetching data, search queries, list endpoints
POSTAPIs that accept filters or payloads in the body

Path Template

The path is appended to the source's base URL. Use Jinja2 syntax to interpolate parameters:

/api/v1/customers/{{ customer_id }}/orders

Parameter values in paths are automatically URL-encoded to prevent injection.

Query Parameters

Define key-value pairs that are appended as query string parameters. Values support Jinja2 templating:

KeyValue Template
q{{ search_term }}
limit{{ limit }}
page{{ page }}

Headers

Add custom headers for the request. These are merged with the source's default headers (tool headers take priority):

HeaderValue
Acceptapplication/json
X-Request-ID{{ request_id }}

Authentication headers (Bearer tokens, API keys) are configured on the HTTP source, not on individual tools. This keeps credentials centralized and encrypted.

Body Template

For POST requests, define a JSON body template with parameter interpolation:

{
  "filters": {
    "status": "{{ status }}",
    "region": "{{ region }}"
  },
  "limit": {{ limit }}
}

Max Response Bytes

Set a limit on the response size (default: 100KB). Responses exceeding this limit are rejected to prevent large payloads from overwhelming AI agents. Adjust this for APIs that return larger datasets.

Example: Wrapping a Search API

Source: https://api.example.com with Bearer token auth

Tool configuration:

  • Method: GET
  • Path: /v2/search
  • Query params: q={{ query }}, limit={{ limit }}
  • Parameters: query (string, required), limit (number, default: 10)

When an AI agent calls this tool with {"query": "annual report", "limit": 5}, Datatape sends:

GET https://api.example.com/v2/search?q=annual%20report&limit=5
Authorization: Bearer <token-from-source>

Response Handling

HTTP tool responses are returned to the AI agent in the same format as SQL tools:

{
  "success": true,
  "data": [{ "id": 1, "title": "Annual Report 2025" }],
  "row_count": 1,
  "execution_time_ms": 230
}
  • JSON responses are parsed and returned as structured data
  • Non-JSON responses are returned as text
  • HTTP 4xx/5xx status codes set success: false

Http Tool Preview

Preview Mode

Use the preview endpoint to see the fully rendered request without executing it. The preview redacts sensitive headers (Authorization, API keys) for safe display.

On this page