goose icon indicating copy to clipboard operation
goose copied to clipboard

Add --output-format json for structured output

Open blackgirlbytes opened this issue 3 months ago • 11 comments

This is a feature request from @MiddleW4y on Discord

Please explain the motivation behind the feature request. goose run only outputs plain text, making it hard to parse tool calls and responses programmatically.

Describe the solution you'd like Similar to Claude Code's --output-format json functionality, add --output-format json flag to output structured data

goose run --output-format json --text "analyze this code"

should output

{
  "messages": [...],
  "tool_calls": [...],
  "responses": [...],
  "metadata": {"total_tokens": 1250, "status": "completed"}
}
  • [x] I have verified this does not duplicate an existing feature request

blackgirlbytes avatar Aug 29 '25 04:08 blackgirlbytes

Thanks for adding this issue! stream-json output format would be great also, rather than just one big JSON output at the end. Like streaming json objects to stdout

{"type": "tool_call", ...} {"type": "message", "role": "assistant", ...}

etc etc

This way you could easily build other kinds of UI on top of goose

Evanfeenstra avatar Aug 29 '25 17:08 Evanfeenstra

you should be able to get this to work by running a recipe

DOsinga avatar Aug 29 '25 18:08 DOsinga

I would like to work on this!

aazam-gh avatar Oct 01 '25 19:10 aazam-gh

thank you so much. go for it. if you end up picking up future issues..you can self assign the issue in your repo..by commenting .take

blackgirlbytes avatar Oct 01 '25 19:10 blackgirlbytes

The issue you are trying to assign to yourself is already assigned.

github-actions[bot] avatar Oct 01 '25 19:10 github-actions[bot]

Gotcha

aazam-gh avatar Oct 01 '25 19:10 aazam-gh

Hi @blackgirlbytes, I’d like to contribute to this issue if it’s still available. Could you please assign it to me? Thanks!

Roshansingh9 avatar Oct 04 '25 07:10 Roshansingh9

Hi, @Roshansingh9 . Thanks for your interest! It looks like @aazam-gh originally asked to be assigned to this, so I want to give them time to work on this issue. If it turns out they don't want this issue anymore then you can pick it up. But in the mean time, you can check here for more Hacktoberfest issues: https://github.com/block/goose/issues/4705

Please read it in detail to learn how to self-assign yourself to a ticket. You will not need me to assign you.

Thanks!

blackgirlbytes avatar Oct 04 '25 11:10 blackgirlbytes

Hi @aazam-gh - wanted to check on your progress with this issue and see if you needed any help :)

taniandjerry avatar Oct 22 '25 15:10 taniandjerry

Removing this Hacktoberfest labels from this issue. Given that it will take more time to contribute to this issue, and there is no PR ready for review, I want to make sure the remaining time this week is used to get all final submissions merged! Anyone is welcome to reopen this if they have a PR ready to contribute.

taniandjerry avatar Oct 28 '25 20:10 taniandjerry

Hi! @taniandjerry I've implemented the --output-format json feature as requested and created a pull request. The implementation includes:

  • Added --output-format flag to goose run command
  • JSON output with messages, tool calls, responses, and metadata
  • Backward compatibility maintained
  • Manual testing completed

The feature is ready for review! @blackgirlbytes

sheikhlimon avatar Nov 02 '25 05:11 sheikhlimon