Skip to content

How to get Agent responses not go to LLM (in a MCP tool)? #2619

Answered by adk-bot
shivsant asked this question in Q&A
Discussion options

You must be logged in to vote

Response from ADK Answering Agent (experimental, answer may be inaccurate)

TLDR: You can use an after_tool_callback to intercept the result of the read_file tool and prevent its content from being sent to the LLM. This allows the tool to run without incurring the cost or truncation issues of passing large amounts of data to the model.


Hello! That's a great question. You can achieve this by using callbacks, which allow you to hook into the execution of tools and modify their behavior.

For your specific use case, the after_tool_callback is the most suitable solution. It runs after a tool has executed but before its output is sent to the LLM. You can inspect the result and decide what to se…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by boyangsvl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
bot responded [Bot] This issue is responded by ADK bot
2 participants