Skip to content

rag_search MCP tool (retrieval + generation) does not report its LLM usage #46

Description

@navalnica

AI DIAL Generic RAG Backend version

latest

What is the problem this feature will solve?

SearchTool.__call__ (src/generic_rag/app/mcp.py:337-374) runs a generation step per call, but:

  • No usage tracking of any kind — no callback, no aggregation.
  • Returns a plain TextContent(type="text", text=text), with no usage signal.
  • A caller invoking rag_search has no way to learn its LLM cost or which model produced the answer.

What is the feature you are proposing to solve the problem?

  • Track usage per model during rag_search's generation step (e.g. a callback recording
    model/deployment alongside each call's token counts).
  • Expose it on the tool result via MCP's _meta field (CallToolResult.meta, mcp.types) — the
    field designed for this kind of extension data.

What alternatives have you considered?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions