Skip to content

feat: route questions to RAG or MCP tools based on query intent #141

@GovindhKishore

Description

@GovindhKishore

Problem

With MCP tools now available in the chatbot, every question goes through the tool calling loop regardless of whether it actually needs live Reactome data. A general knowledge question like "What does TP53 do?" has no business hitting the MCP server - the vector database already has that answer and is faster.

There is currently no mechanism to distinguish between:

Questions answerable from the static knowledge base (RAG)
Questions requiring live Reactome lookup by identifier or name (MCP search)
Questions requiring pathway enrichment analysis on a gene list (MCP analysis)

Proposed Solution

Add an LLM-based query router that classifies each question into one of three routes before any retrieval happens. Based on the route, the agent is given only the relevant tool subset - search/lookup tools or the analysis tool - rather than all tools at once.

This keeps RAG as the default path when MCP tools are not needed, and ensures the LLM is never given tools irrelevant to the question.

Benefits

Faster responses for general knowledge questions - no unnecessary MCP calls
Cleaner tool calling - LLM presented with focused tool subset per route
Sets up foundation for adding more routes as new data sources are integrated

Files affected

src/mcp/query_router.py - new
src/agent/profiles/react_to_me.py - modified

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions