Skip to content

Some DBA tools generate too many tokens which makes them unusable at scale #249

@gregory-leduc

Description

@gregory-leduc

Describe the bug
The problem has been detected with the tool dba_userSqlList, but it can appear with other tools as well (such as dba_featureUsage) if they generate a result set with many rows (several hundreds are enough to reproduce the issue).
Concretely the full result set is added to the prompt, and will generate an error indicating that too many tokens are used (example in Mistral : "max_tokens must be at least 1, got -370387.")

To Reproduce
Error reproduced in Flowise, by configuring an agent that has access to Teradata MCP server with DBA profile.
I reproduced the error with mistralai/Ministral-3-14B-Instruct-2512 model.
The MCP server points to a ClearScape Analytics Experience instance where DEMO_USER has executed several thousands of queries.

Example of prompt: "What query executed by DEMO_USER consumed the most CPU in the last 30 days?".

With Claude model, we don't immediately notice the issue, because it will use base_readQuery if an error occrus, and it will display the expected result. But if we disable base_readQuery tool, we'll get an error as well.

Expected behavior
To work in the real life, the DBA tools should be designed considering that the query history may generate millions of rows. By asking for the most consuming queries, there should be at least a "TOP 10" by default in the generated query

Screenshots
Example of error when asking for the biggest queries executed by a user:
Image

Same error when asking for the most frequent features used:
Image

Asking for the Teradata version works well, so there is no configuration issue:
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions