Skip to content

feat: Implement ui/update-model-context for MCP Apps #6472

@aharvard

Description

@aharvard

Summary

Implement the ui/update-model-context method from the MCP Apps specification (ext-apps PR #125, now merged).

This allows MCP Apps to update the host's model context without triggering a follow-up action - unlike ui/message which triggers agent processing, or notifications/message which is for logging.

Use Case

An MCP App can inform the agent about app state changes (e.g., "User selected 3 items totaling $150") that should influence future responses, without immediately prompting the agent to act.

What's Missing

  1. UI Layer (ui/desktop/src/components/McpApps/)

    • Handle ui/update-model-context requests from Guest UI
    • Advertise capability in hostCapabilities during ui/initialize
  2. Server Layer (crates/goose-server/)

    • New endpoint to receive and store context updates
  3. Agent Layer (crates/goose/src/agents/)

    • Storage for MCP App contexts (keyed by extension + resource URI)
    • Include stored context in model prompts for future turns

Spec Reference

// Request (Guest UI → Host)
{
  method: "ui/update-model-context",
  params: {
    content?: ContentBlock[],
    structuredContent?: Record<string, unknown>
  }
}

// Response
{ result: {} }

Host behavior per spec:

  • SHOULD provide context to model in future turns
  • MAY overwrite previous context with new update
  • If multiple updates before next user message, SHOULD only send the last

Related

Metadata

Metadata

Labels

mcpMCP/Extension relatedmcp-apps-complianceMCP Apps spec compliance (2026-01-26)p2Priority 2 - Medium

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions