You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`mcp_max_rows` - Maximum number of rows the `db_execute_query` MCP tool returns per result set before truncating, to limit how much data lands in an AI agent's context. Only applies to the MCP tool, not CLI commands. Default: `100`
248
249
-`output` - Output format: `json`, `yaml`, or `table` (default: `table`)
-`read_only` - When `true`, mutating operations are refused: the `tiger service create`/`fork`/`start`/`stop`/`resize`/`update-password`/`delete` CLI commands and their MCP equivalents return an error, and `tiger db connect`, `tiger db connection-string`, and the `db_execute_query` MCP tool open the database session in Tiger Cloud's immutable read-only mode (writes and DDL are rejected by the server). Read commands/tools are unaffected — `tiger db schema` and the `db_schema` MCP tool always open a read-only session regardless of this setting. Default: `false`.
// mcpMaxResponseBytes caps total serialized row data per response, catching a
23
+
// few very wide rows the row cap alone would miss. Not user-configurable.
24
+
mcpMaxResponseBytes=256*1024
25
+
)
26
+
27
+
// resolveMaxRows returns the row cap from mcp_max_rows, falling back to the
28
+
// default for non-positive config-file/env values (which skip set validation).
29
+
funcresolveMaxRows(configuredint) int {
30
+
ifconfigured<=0 {
31
+
returnconfig.DefaultMCPMaxRows
32
+
}
33
+
returnconfigured
34
+
}
35
+
36
+
// approxRowSize estimates a row's serialized size in bytes for the byte budget,
37
+
// mirroring how it is ultimately marshaled to JSON for the client.
38
+
funcapproxRowSize(values []any) int {
39
+
ifb, err:=json.Marshal(values); err==nil {
40
+
returnlen(b)
41
+
}
42
+
// Fallback for the rare value that isn't JSON-marshalable.
43
+
returnlen(fmt.Sprint(values...))
44
+
}
45
+
46
+
// truncationNotice builds the actionable guidance returned to the model when a
47
+
// response is truncated.
48
+
functruncationNotice(maxRowsint) string {
49
+
returnfmt.Sprintf("Results were truncated to limit the amount of data returned (the configured mcp_max_rows=%d per result set, plus an overall response size cap). More rows exist. Do the work in the database instead of re-running this query: aggregate (GROUP BY, COUNT, SUM, AVG), filter (WHERE), or paginate (LIMIT/OFFSET).", maxRows)
50
+
}
51
+
20
52
// DBExecuteQueryInput represents input for db_execute_query
resultSetSchema.Properties["rows"].Description="Result rows as arrays of values. Omitted for commands that don't return rows (INSERT, UPDATE, DELETE, etc.)"
resultSetSchema.Properties["rows_affected"].Description="Number of rows affected. For SELECT, this is the number of rows returned. For INSERT/UPDATE/DELETE, this is the number of rows modified. Returns 0 for statements that don't return or modify rows (e.g. CREATE TABLE)."
134
+
resultSetSchema.Properties["rows_affected"].Description="Number of rows affected. For SELECT, this is the total number of rows the query produced; when truncated is true this exceeds the number of rows actually returned in this response. For INSERT/UPDATE/DELETE, this is the number of rows modified. Returns 0 for statements that don't return or modify rows (e.g. CREATE TABLE)."
resultSetSchema.Properties["truncated"].Description="True when this result set was capped (by the configured mcp_max_rows row limit or the overall response size limit) and additional rows exist that were not returned. Refine the query in SQL to get the data you need."
138
+
102
139
schema.Properties["execution_time"].Description="Execution time as a human-readable duration string"
schema.Properties["truncated"].Description="True when any result set was truncated to limit the amount of data returned. See notice for guidance."
143
+
144
+
schema.Properties["notice"].Description="Present only when results were truncated. Actionable guidance for getting the needed data via SQL (aggregate, filter, paginate) instead of re-running the query."
145
+
105
146
returnschema
106
147
}
107
148
@@ -116,6 +157,8 @@ Connects to a PostgreSQL database service in Tiger Cloud and executes the provid
116
157
117
158
Multi-statement queries (semicolon-separated) are supported when no parameters are provided. All result sets are returned. By default, statements execute in an implicit transaction that automatically commits on success or rolls back on error. Explicit transactions (opened with BEGIN) must be explicitly committed with COMMIT, or they roll back when the connection closes.
118
159
160
+
Process data in the database, not in your context: aggregate, filter, sort/limit, and join in SQL rather than fetching raw rows.
161
+
119
162
WARNING: Can execute any SQL statement including INSERT, UPDATE, DELETE, and DDL commands. Always review queries before execution.`,
0 commit comments