Overview
Response adapters parse non-standard MCP tool output into structured rows for Parquet staging. They are used withfetch_mode: mcp_client when a tool returns output that isn’t plain JSON, CSV, or NDJSON.
Adapters are selected via the response_adapter field in binding.yaml:
Built-in Formats vs Adapters
There are two tiers of response handling: Tier 1: Built-in formats (response_format) — generic, well-defined grammars:
| Format | Description |
|---|---|
json | Default. JSON array or object navigated via items_path |
csv | RFC 4180 CSV. First row = headers |
ndjson | Newline-delimited JSON. One object per line |
response_adapter) — registered parsers for non-standard output:
| Adapter | Tool | Description |
|---|---|---|
tabular_text | vendor Query | Prose headers + tabular row data (two sub-formats) |
response_format and response_adapter are mutually exclusive.
The TabularText Adapter
Thetabular_text adapter handles vendor Query output, which returns human-readable text rather than structured data. It auto-detects between two output formats:
Format A: Pipe-delimited
Columns:line defines pipe-separated header names---separator marks the start of data rows- Each data row uses
|as the delimiter
Format B: Python-list literals
Column Names:line defines comma-separated header namesRow N:lines contain Python-style list literals- Quoted values handle commas (
'Doe, Jane') and escaped quotes ('O\'Brien')
Column Names:, format B is used. Otherwise, format A.
Binding example
Writing a Custom Adapter
Function signature
text— the raw response body from the MCP toolfields— column metadata from the contract (source name, column name, type)- Returns a slice of row maps (column name → value) or an error
Registration
Register your adapter ininternal/loaders/response_adapters.go:
Registration API
Guidelines
- Return source field names — the staging layer handles
field_mapremapping. Your adapter should return keys matching the raw tool output, not the contract column names. - All values as strings are fine — the Parquet writer coerces types based on the contract’s column type definitions.
- Return clear errors — include enough context to diagnose the problem (e.g., “tabular_text: could not find column headers”).
- Test both happy path and malformed input — adapters are the boundary between unpredictable tool output and the structured staging layer.
Interaction with Pagination
Response adapters work with offset-mode pagination. Each page is parsed independently through the adapter. Cursor-mode pagination is incompatible with adapters — cursor extraction requires a JSON envelope, which adapter-parsed responses don’t provide. Configuringpagination.mode: cursor with a response_adapter produces an error at runtime.
Interaction with Fetch Modes
| Fetch mode | response_format | response_adapter | Behavior |
|---|---|---|---|
mcp_client | json (default) | — | JSON parse + items_path navigation |
mcp_client | csv | — | CSV parse, first row = headers |
mcp_client | ndjson | — | Line-by-line JSON parse |
mcp_client | — | tabular_text | TabularText-specific parser |
mcp | ignored | ignored | Agent handles parsing manually |
native | ignored | ignored | Strategy handles its own data |
mcp_client uses response_format and response_adapter. Other fetch modes ignore these fields.
