Skip to content

feat: tell agents each database's provider, and size results for a model's context - #11

Merged
fuseraft merged 1 commit into
masterfrom
feat/agent-ergonomics
Oct 19, 2026
Merged

fuseraft merged 1 commit into
masterfrom
feat/agent-ergonomics

Conversation

@fuseraft

@fuseraft fuseraft commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

An agent had no way to tell which SQL dialect a database speaks, and one query could return about a million tokens, more than a model's whole context.

  • Providers. list_databases returns [{"name":"prod","provider":"Postgres"}, …], and its description tells the agent to write each database's SQL in that provider's dialect. Before, the agent learned TOP vs LIMIT vs FETCH FIRST from a syntax error.
  • Rows as arrays. Each row is an array of values in the order of columns, so column names aren't repeated on every row. /api/query returns the same shape.
  • Smaller defaults. App:MaxRows goes from 1000 to 100, and App:MaxResultBytes from 4000000 to 100000 (about 25,000 tokens). The new App:MaxTables (default 1000) limits list_tables, which MaxRows used to, so the table list isn't cut to 100.
  • Truncation notes. A truncated result has a note saying which limit stopped it and how to narrow or page the query, with paging in the database's own syntax:
{ "columns": ["n","sq"], "rows": [[1,1], …, [100,10000]], "truncated": true,
  "note": "Only the first 100 rows are shown (App:MaxRows). Narrow the query with WHERE, summarize it with GROUP BY, or page through it with ORDER BY ... LIMIT 100 OFFSET 100." }

Tested locally: the full suite against all four databases (319 tests), and a 500-row query over MCP against Postgres, which now returns 100 rows in 1,172 characters with the note.

…del's context

- list_databases returns each database's provider alongside its name, so an agent
  knows which SQL dialect to write instead of finding out from a syntax error.
- Query rows are arrays in column order rather than objects, so column names
  aren't repeated on every row. This applies to /api/query as well.
- App:MaxRows now defaults to 100 and App:MaxResultBytes to 100000 (about 25,000
  tokens), down from 1000 and 4000000. The new App:MaxTables (default 1000) limits
  list_tables, which MaxRows used to.
- A truncated result carries a note saying which limit stopped it and how to
  narrow or page the query, with paging in the database's own syntax.
@fuseraft
fuseraft merged commit 4a7ce53 into master Oct 19, 2026
2 checks passed
@fuseraft fuseraft changed the title feat: tell agents each database's provider, and size results for a model's context feat: give agents the schema context and result sizes they need to write good SQL Oct 19, 2026
@fuseraft fuseraft changed the title feat: give agents the schema context and result sizes they need to write good SQL feat: tell agents each database's provider, and size results for a model's context Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant