-
Notifications
You must be signed in to change notification settings - Fork 164
Add system prompt to clarify the scope of session-sql tool #1691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds clarification to the system prompt about the specific scope of the session-sql tool to prevent LLM from incorrectly selecting it for general database queries. The tool is meant exclusively for AWS cost/billing MCP tool-generated tables and temporary analysis, not for user database queries.
- Added explicit guidance in the system prompt defining when the
session-sqltool should be used
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Greptile OverviewGreptile SummaryAdded clarifying note to the LLM system prompt to prevent incorrect tool selection for the
Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant LLM as LLM Query Router
participant SystemPrompt as getSystemPrompt()
participant LLMModel as Language Model
User->>LLM: routeQuery(messages, tools, ...)
LLM->>SystemPrompt: Generate system prompt
Note over SystemPrompt: Adds clarifying note:<br/>"session-sql tool is ONLY<br/>for AWS cost/billing tables"
SystemPrompt-->>LLM: Return enhanced prompt
LLM->>LLMModel: generateObject(system prompt + messages)
LLMModel-->>LLM: Returns tool_names & classification
Note over LLMModel: Now correctly excludes<br/>session-sql for general<br/>database queries
LLM-->>User: Selected tools & classification
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 1 comment
| `IMPORTANT: Tables tools should always be included in the output if the user asks a question involving those table names: ${openopsTablesNames.join( | ||
| ', ', | ||
| )}. ` + | ||
| "NOTE: The 'session-sql' tool is ONLY for querying tables created by AWS cost/billing MCP tools and performing temporary analysis. It is NOT for user's database or table related queries. " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Grammatical issue: "user's" should be "the user's" for clarity
| "NOTE: The 'session-sql' tool is ONLY for querying tables created by AWS cost/billing MCP tools and performing temporary analysis. It is NOT for user's database or table related queries. " + | |
| "NOTE: The 'session-sql' tool is ONLY for querying tables created by AWS cost/billing MCP tools and performing temporary analysis. It is NOT for the user's database or table related queries. " + |
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/server/api/src/app/ai/mcp/llm-query-router.ts
Line: 210:210
Comment:
**style:** Grammatical issue: "user's" should be "the user's" for clarity
```suggestion
"NOTE: The 'session-sql' tool is ONLY for querying tables created by AWS cost/billing MCP tools and performing temporary analysis. It is NOT for the user's database or table related queries. " +
```
How can I resolve this? If you propose a fix, please make it concise.
|
| `IMPORTANT: Tables tools should always be included in the output if the user asks a question involving those table names: ${openopsTablesNames.join( | ||
| ', ', | ||
| )}. ` + | ||
| "NOTE: The 'session-sql' tool is ONLY for querying tables created by AWS cost/billing MCP tools and performing temporary analysis within the session. It is NOT for user's database or table related queries. " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this @ravikiranvm .
There might be other tools in the future that cause this problem.
I think a broader solution is needed, to say that certain tools do not mix with each other.
Please consult with Eran.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I will talk to Eran.



Fixes OPS-3138
Additional Notes
Although it's not happening most of the times, LLM once included
session-sqltool in the tool selection output even for a simple query likedo you have access to my tables?I've checked the description of this tool:

The description is kinda generic and may not be clear for LLM to use it correctly in our app. So I've modified the system prompt to clarify the scope of this tool
Alternative fix: Do we really need this
session-sqltool? Can we exclude it from the tools selection?