Skip to content

Commit 2afe062

Browse files
authored
docs: document base_readQuery row cap and DEFAULT_ROW_LIMIT / MAX_ROW_LIMIT env vars (#308)
Adds DEFAULT_ROW_LIMIT and MAX_ROW_LIMIT to the env vars quick-reference and a new Query Result Limits section in CONFIGURATION.md explaining truncation behaviour and the persist=true escape hatch. Updates CLAUDE.md Database Connectivity section with the same context for in-editor guidance.
1 parent c42e7b7 commit 2afe062

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ Settings dataclass in `config/__init__.py` merges CLI args, environment variable
8080

8181
Tool handlers receive either a SQLAlchemy `Connection` or raw `TeradataConnection` as their first parameter — the wrapper in `app.py` handles injection.
8282

83+
`base_readQuery` caps result rows to prevent LLM token overflow: default 1000 rows, hard ceiling 50000. Configurable via `DEFAULT_ROW_LIMIT` and `MAX_ROW_LIMIT` env vars. When truncated, response metadata includes `truncated: true`; callers can pass a higher `row_limit` or use `persist=true` to bypass the cap.
84+
8385
### Transport Modes
8486

8587
Set via `MCP_TRANSPORT` env var or `--mcp_transport` flag:

docs/server_guide/CONFIGURATION.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ export TD_POOL_SIZE="5" # connection pool size
3737
export TD_MAX_OVERFLOW="10" # max overflow connections
3838
export TD_POOL_TIMEOUT="30" # connection timeout seconds
3939

40+
# Optional: Query result limits
41+
export DEFAULT_ROW_LIMIT="1000" # default max rows returned by base_readQuery
42+
export MAX_ROW_LIMIT="50000" # hard ceiling; callers cannot exceed this
43+
4044
# Optional: Authentication (see Security guide)
4145
export AUTH_MODE="none" # or "basic"
4246
export AUTH_CACHE_TTL="300" # seconds
@@ -322,6 +326,19 @@ export TD_MAX_OVERFLOW="10" # Additional connections under load
322326
export TD_POOL_TIMEOUT="30" # Seconds to wait for connection
323327
```
324328

329+
### Query Result Limits
330+
331+
`base_readQuery` caps results to prevent LLM token overflow. Results beyond the limit are silently dropped and the response metadata includes `"truncated": true`.
332+
333+
```bash
334+
export DEFAULT_ROW_LIMIT="1000" # Default max rows per base_readQuery call
335+
export MAX_ROW_LIMIT="50000" # Hard ceiling; the row_limit parameter cannot exceed this
336+
```
337+
338+
When a query is truncated, the LLM can:
339+
- Pass a higher `row_limit` (up to `MAX_ROW_LIMIT`) to retrieve more rows in a single response.
340+
- Pass `persist=true` to write the full result set to a volatile table and query it directly — this bypasses the row cap entirely and is recommended for large result sets.
341+
325342
### Authentication Methods
326343

327344
```bash

0 commit comments

Comments
 (0)