That’s a good question, and I do not have any examples I can point you towards.
There is nothing built-in, but you can use the llm_node to intercept the input going to the MCP.
async def llm_node(
self,
chat_ctx: llm.ChatContext,
tools: list[Any],
model_settings: ModelSettings,
) -> AsyncGenerator[llm.ChatChunk | str, None]:
"""Log all tool-call content from the LLM (what would be sent to MCP when it's an MCP tool)."""
async for chunk in Agent.default.llm_node(
self, chat_ctx, tools, model_settings
):
if isinstance(chunk, llm.ChatChunk) and chunk.delta and chunk.delta.tool_calls:
for tc in chunk.delta.tool_calls:
logger.info(
"LLM tool call (content sent to MCP when MCP tool): name=%r arguments=%r",
tc.name,
tc.arguments,
)
yield chunk