Skip to content

Conversation

@alexhancock
Copy link
Collaborator

Overview

Implements client support for MCP's Elicitation feature (form mode)

Arch

General MCP Message Flow (from MCP docs)

MCP Message Flow

Flow Described in Goose Specific Components

Goose Elicitaton Flow

Demos

CLI

CLI UX

Desktop

Desktop UX 1 Desktop UX 2

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements client support for the MCP (Model Context Protocol) elicitation feature, enabling MCP servers to request structured information from users via dynamic forms during tool execution. The implementation spans both Rust backend (agent logic, MCP client, message types) and TypeScript frontend (React form components, chat integration), with support for both CLI and desktop interfaces.

Key Changes

  • Added ActionRequiredManager for coordinating elicitation requests/responses between MCP servers and UI layers via async channels
  • Extended message types to support elicitation requests and responses with JSON Schema-based form definitions
  • Implemented dynamic form rendering in desktop UI using JsonSchemaForm component with validation

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
crates/goose/src/action_required_manager.rs New global manager coordinating elicitation lifecycle with async channels and timeout handling
crates/goose/src/agents/agent.rs Integrated elicitation message routing and response handling into agent reply loop
crates/goose/src/agents/mcp_client.rs Implemented MCP ClientHandler::create_elicitation with 5-minute timeout
crates/goose/src/conversation/message.rs Added Elicitation and ElicitationResponse variants to ActionRequiredData enum
crates/goose/src/context_mgmt/mod.rs Added formatting for elicitation messages in conversation compacting
crates/goose-cli/src/session/mod.rs Integrated CLI elicitation handling with cancellation support
crates/goose-cli/src/session/elicitation.rs New CLI form collection with terminal UI for various JSON Schema field types
crates/goose-cli/src/session/output.rs Added rendering for elicitation message types
crates/goose-cli/src/session/export.rs Added markdown export formatting for elicitation content
ui/desktop/src/types/message.ts Added helper functions for creating and extracting elicitation messages
ui/desktop/src/hooks/useChatStream.ts Implemented submitElicitationResponse handler with streaming integration
ui/desktop/src/components/ui/JsonSchemaForm.tsx New dynamic form component supporting string/number/boolean/enum types with validation
ui/desktop/src/components/ElicitationRequest.tsx React component managing elicitation UI states (pending/submitted/cancelled)
ui/desktop/src/components/GooseMessage.tsx Integrated ElicitationRequest rendering into message display
ui/desktop/src/components/ProgressiveMessageList.tsx Threaded submitElicitationResponse callback through component hierarchy
ui/desktop/src/components/BaseChat.tsx Passed elicitation handler from useChatStream to message list
ui/desktop/src/components/ToolCallConfirmation.tsx Added type extraction for discriminated union safety
ui/desktop/src/api/types.gen.ts Generated TypeScript types for elicitation action variants
ui/desktop/openapi.json Extended OpenAPI schema with elicitation/elicitationResponse objects
crates/goose/src/lib.rs Exported new action_required_manager module

@alexhancock alexhancock force-pushed the alexhancock/elicitation branch from 326f890 to 2bd5e18 Compare December 3, 2025 18:48
@alexhancock alexhancock requested a review from zanesq December 3, 2025 18:49
@alexhancock alexhancock force-pushed the alexhancock/elicitation branch from 2bd5e18 to a1c408e Compare December 3, 2025 21:12
Copilot AI review requested due to automatic review settings December 3, 2025 21:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 24 changed files in this pull request and generated 4 comments.

@michaelneale
Copy link
Collaborator

a great jump forward with MCP support, and something we have wanted for a long time, allows MCPs to basically be mini apps in a way.

some feedback inline (and maybe some of the copilot feedback is legit - logic errors maybe)?

Seemed like more code than I thought for cli, but that is ok (wasn't sure how this applied to cli - if we even want it in cli etc?)

@alexhancock
Copy link
Collaborator Author

@michaelneale Thanks for review.

Yes, I agree it was more code than I expected for CLI as well. I will see if I can whittle down the implementation to something simpler which asks for the inputs one by one with minimal code tomorrow. It has a lot of fancy formatting stuff right now.

@michaelneale @zanesq Another question for all of us to ponder: how can we integration test this? It requires a sort of interactive mode of input by the user.

@zanesq
Copy link
Collaborator

zanesq commented Dec 4, 2025

The playwright e2e tests should be able to interact with it. I think we should strip tests those down to only main happy paths for high level smoke testing however. Currently they are a bit too granular. Planning on coming back to those soon and pruning/changing to be our release checklist steps.

@alexhancock alexhancock force-pushed the alexhancock/elicitation branch from a1c408e to aa9c7f3 Compare December 4, 2025 20:04
Copilot AI review requested due to automatic review settings December 4, 2025 20:19
@alexhancock alexhancock force-pushed the alexhancock/elicitation branch from aa9c7f3 to 408293b Compare December 4, 2025 20:19
@alexhancock alexhancock force-pushed the alexhancock/elicitation branch from 408293b to 27b3a86 Compare December 4, 2025 20:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.

@alexhancock alexhancock force-pushed the alexhancock/elicitation branch from 27b3a86 to db97f86 Compare December 4, 2025 20:33
Copilot AI review requested due to automatic review settings December 4, 2025 20:38
@alexhancock alexhancock force-pushed the alexhancock/elicitation branch from db97f86 to a26e9c8 Compare December 4, 2025 20:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.

@alexhancock alexhancock force-pushed the alexhancock/elicitation branch from a26e9c8 to b879c19 Compare December 4, 2025 20:47
Copilot AI review requested due to automatic review settings December 4, 2025 21:02
@alexhancock alexhancock force-pushed the alexhancock/elicitation branch from b879c19 to 2d3b2c4 Compare December 4, 2025 21:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 24 changed files in this pull request and generated 4 comments.

@alexhancock alexhancock force-pushed the alexhancock/elicitation branch from 2d3b2c4 to 1770580 Compare December 4, 2025 21:15
Copy link
Collaborator

@michaelneale michaelneale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think looks ok. would be nice if @zanesq thought so too.

I wonder if this needs some additional. support in goose web and goose-ios so when they see those message types they can deal/ignore it (depending on what level of broad support we want0.

@zanesq
Copy link
Collaborator

zanesq commented Dec 4, 2025

Will take a look soon after I get the release out...

Copy link
Collaborator

@zanesq zanesq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM!

@alexhancock

  1. I wonder if we should use an open source JSON Schema Form library that supports all available things or do you think this is sufficient to support the things people can throw at it with the Elicitation standard?
  2. Can you add a quick local mcp example to test it? Like running quotes we would use it in our E2E tests. Tried asking goose to create one but didn't work. Could be a follow up also but figured it would be a nice way to verify this works for other people.

@zanesq
Copy link
Collaborator

zanesq commented Dec 5, 2025

One more note we use tanstack forms with zod validation now so you could change this form to use that to be consistent. Also not a blocker can be a follow up.

@alexhancock
Copy link
Collaborator Author

@zanesq Got it! Can you send me an example of another form that uses our intended best practice/std?

@zanesq
Copy link
Collaborator

zanesq commented Dec 5, 2025

@alexhancock simplest example would be https://github.com/block/goose/blob/main/ui/desktop/src/components/recipes/ImportRecipeForm.tsx

@alexhancock alexhancock merged commit 06155ce into main Dec 6, 2025
18 checks passed
@alexhancock alexhancock deleted the alexhancock/elicitation branch December 6, 2025 02:30
@alexhancock
Copy link
Collaborator Author

@zanesq Thanks - I will look at the form in another change. See if I can replace it with an off-the-shelf or convert it to use our chosen underlying components (tanstack + zod)

@alexhancock
Copy link
Collaborator Author

I will also look at URL mode elicitation in a followup

tlongwell-block added a commit that referenced this pull request Dec 7, 2025
* origin/main:
  feat(mcp): elicitation support (#5965)
  Onboarding detect provider from api key (#5955)
  Fix PATH on Windows for extensions (#6000)
  recipe(datahub): Add a recipe for searching & understanding data in DataHub (#5859)
  fix params not being substituted in activities (#5992)
  blog: MCP Sampling (#5987)
zanesq added a commit that referenced this pull request Dec 8, 2025
* 'main' of github.com:block/goose: (21 commits)
  Hide recipe icon in empty chat (#6022)
  docs: provider and model config (#6008)
  Show modal selector after configuring a provider (#6005)
  docs: additional mcp sampling resources (#6020)
  Flutter PR Code Review (#6011)
  feat(mcp): elicitation support (#5965)
  Onboarding detect provider from api key (#5955)
  Fix PATH on Windows for extensions (#6000)
  recipe(datahub): Add a recipe for searching & understanding data in DataHub (#5859)
  fix params not being substituted in activities (#5992)
  blog: MCP Sampling (#5987)
  Update Anthropic and Google Gemini models to latest API versions (#5980)
  docs: chat recall tutorial (#5975)
  fix: `final assistant content cannot end with trailing whitespace` error from Anthropic (#5967)
  5527 multiple file popups (#5905)
  Groq configure fix  (#5833)
  added sidebar contextual information for firefox (#5433)
  docs: council of mine MCP (#5979)
  docs: nano banana extension (#5977)
  fix: remove prompt change, read model from config (#5976)
  ...

# Conflicts:
#	ui/desktop/src/api/sdk.gen.ts
#	ui/desktop/src/components/bottom_menu/DirSwitcher.tsx
zanesq added a commit that referenced this pull request Dec 9, 2025
* 'main' of github.com:block/goose:
  gov: new LF Projects LLC section (#6027)
  Cleanup: Remove Recipe Key Flow (#6015)
  chore(deps): bump mdast-util-to-hast from 13.2.0 to 13.2.1 in /documentation (#5963)
  remove problematic corrupted woff font (#6006)
  Added search bar / filtering for recipes (#6019)
  Hide recipe icon in empty chat (#6022)
  docs: provider and model config (#6008)
  Show modal selector after configuring a provider (#6005)
  docs: additional mcp sampling resources (#6020)
  Flutter PR Code Review (#6011)
  feat(mcp): elicitation support (#5965)
  Onboarding detect provider from api key (#5955)
  Fix PATH on Windows for extensions (#6000)
  recipe(datahub): Add a recipe for searching & understanding data in DataHub (#5859)
  fix params not being substituted in activities (#5992)
katzdave added a commit that referenced this pull request Dec 10, 2025
* 'main' of github.com:block/goose: (159 commits)
  Cleanup: Remove Recipe Key Flow (#6015)
  chore(deps): bump mdast-util-to-hast from 13.2.0 to 13.2.1 in /documentation (#5963)
  remove problematic corrupted woff font (#6006)
  Added search bar / filtering for recipes (#6019)
  Hide recipe icon in empty chat (#6022)
  docs: provider and model config (#6008)
  Show modal selector after configuring a provider (#6005)
  docs: additional mcp sampling resources (#6020)
  Flutter PR Code Review (#6011)
  feat(mcp): elicitation support (#5965)
  Onboarding detect provider from api key (#5955)
  Fix PATH on Windows for extensions (#6000)
  recipe(datahub): Add a recipe for searching & understanding data in DataHub (#5859)
  fix params not being substituted in activities (#5992)
  blog: MCP Sampling (#5987)
  Update Anthropic and Google Gemini models to latest API versions (#5980)
  docs: chat recall tutorial (#5975)
  fix: `final assistant content cannot end with trailing whitespace` error from Anthropic (#5967)
  5527 multiple file popups (#5905)
  Groq configure fix  (#5833)
  ...
katzdave added a commit that referenced this pull request Dec 10, 2025
…nses-streaming

* 'main' of github.com:block/goose:
  blog: How to stop your ai agent from making unwanted code changes (#6055)
  Fix typo in prompt (#6007)
  Docs for new terminal integration feature (#6042)
  fix: linux goosed crashing libssl error (#6051)
  chore(release): release version 1.16.0 (minor) (#5985)
  fix: metrics on posthog (#6024)
  gov: new LF Projects LLC section (#6027)
  Cleanup: Remove Recipe Key Flow (#6015)
  chore(deps): bump mdast-util-to-hast from 13.2.0 to 13.2.1 in /documentation (#5963)
  remove problematic corrupted woff font (#6006)
  Added search bar / filtering for recipes (#6019)
  Hide recipe icon in empty chat (#6022)
  docs: provider and model config (#6008)
  Show modal selector after configuring a provider (#6005)
  docs: additional mcp sampling resources (#6020)
  Flutter PR Code Review (#6011)
  feat(mcp): elicitation support (#5965)
katzdave added a commit that referenced this pull request Dec 12, 2025
…oose into dkatz/openai-responses-streaming

* 'dkatz/openai-responses-streaming' of github.com:block/goose:
  Rm stray
  leave errors in the context
  blog: How to stop your ai agent from making unwanted code changes (#6055)
  Fix typo in prompt (#6007)
  Docs for new terminal integration feature (#6042)
  fix: linux goosed crashing libssl error (#6051)
  chore(release): release version 1.16.0 (minor) (#5985)
  fix: metrics on posthog (#6024)
  gov: new LF Projects LLC section (#6027)
  Cleanup: Remove Recipe Key Flow (#6015)
  chore(deps): bump mdast-util-to-hast from 13.2.0 to 13.2.1 in /documentation (#5963)
  remove problematic corrupted woff font (#6006)
  Added search bar / filtering for recipes (#6019)
  Hide recipe icon in empty chat (#6022)
  docs: provider and model config (#6008)
  Show modal selector after configuring a provider (#6005)
  docs: additional mcp sampling resources (#6020)
  Flutter PR Code Review (#6011)
  feat(mcp): elicitation support (#5965)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants