genkit icon indicating copy to clipboard operation
genkit copied to clipboard

[Go] PartToolResponse missing tool call information

Open mattsp1290 opened this issue 2 months ago • 6 comments

Describe the bug PartToolResponse is missing tool call information. It contains the tool response, but not which tool was called or with what arguments.

To Reproduce The call to genkit is here https://github.com/mattsp1290/october-talks-2025/blob/main/example/server/internal/agentic/agentic.go#L129-L133

When using streaming responses and mcp servers, the response does not include which tool was called.

Expected behavior The response shows which tool is called so I can display to the user that X was called and Y was the result.

Screenshots Image

Runtime (please complete the following information):

  • OS: macOS
  • Version 15.6.1

** Go version

  • go1.24.5 darwin/arm64

mattsp1290 avatar Oct 23 '25 15:10 mattsp1290

Hi @mattsp1290, we'll take a look at this.

hugoaguirre avatar Oct 23 '25 19:10 hugoaguirre

Hi @mattsp1290. ToolRequest and its contents are part of the generate request object. In this case, ToolResponse part won't have the request information but the output and the tool name.

May I ask, what is your current use case?

hugoaguirre avatar Nov 05 '25 00:11 hugoaguirre

Hi @mattsp1290. ToolRequest and its contents are part of the generate request object. In this case, ToolResponse part won't have the request information but the output and the tool name.

May I ask, what is your current use case?

Are there hooks into the generate request object?

The use case is building a CLI application like Claude Code and showing the user which tool was called along with the result by integration genkit with AG-UI

mattsp1290 avatar Nov 06 '25 23:11 mattsp1290

What kind of hooks are you referring to?

You can access the request message information right from the response struct. This way you can inspect which tool and input schemas were provided.

Hope this helps!

hugoaguirre avatar Nov 07 '25 01:11 hugoaguirre

What kind of hooks are you referring to?

You can access the request message information right from the response struct. This way you can inspect which tool and input schemas were provided.

Hope this helps!

I included a screenshot of what the response struct looks like. It does not include which tool and input schemas were provided. This issue may be limited to when genkit is called WithStreaming.

My use case may not have been exact. It's closer to Cursor Background Agents. The agent runs on a remote server and I would like the client to be able to know which tools are called along with their response.

mattsp1290 avatar Nov 10 '25 01:11 mattsp1290

Yeah, the screenshot shows the Chunk response struct. I was referring to the complete response from the genkit.Generate() call you make at this point. The tools information should be available in resp.Request.Tools

hugoaguirre avatar Nov 11 '25 14:11 hugoaguirre

It looks like I was not properly handling the Part that gets emitted on ToolRequest. This can be closed.

mattsp1290 avatar Dec 01 '25 17:12 mattsp1290