Skip to content

Conversation

@antonpk1
Copy link
Collaborator

Summary

Adds tool visibility control and restructures tool metadata for cleaner API.

Changes

1. Restructured _meta format:

// Before
_meta: { "ui/resourceUri": "ui://..." }

// After  
_meta: { ui: { resourceUri: "ui://...", visibility: ["model", "apps"] } }

2. Added visibility array:

Value Model sees App calls Use case
["model"] Default (standard MCP)
["apps"] Refresh buttons, UI-only
["model", "apps"] Interactive tools

3. Key behaviors:

  • ["apps"] scope is per-server (cross-server calls blocked)
  • Host MUST hide app-only tools from agent's tool list
  • Host MUST reject app tools/call for tools without "apps" visibility

Why single visibility vs OpenAI's two fields?

OpenAI uses widgetAccessible + visibility separately. We use one array because:

  • Less redundant
  • Clearer intent: "who is this tool for?"
  • Covers all combinations

Discussion points for meeting

  • Is ["model"] the right default? (preserves standard MCP behavior)
  • Should we support more granular scopes in future?

🤖 Generated with Claude Code

- Restructure tool metadata: `_meta["ui/resourceUri"]` → `_meta.ui.resourceUri`
- Add `visibility` array field: ["model"], ["apps"], or ["model", "apps"]
- Default ["model"] preserves standard MCP behavior
- ["apps"] enables widget-only tools hidden from agent
- Add McpUiToolMeta interface for type safety
- Add Design Decision #4 explaining approach vs OpenAI's two-field model

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 11, 2025

Open in StackBlitz

npm i https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/ext-apps@131

commit: e9e434d

Copy link
Collaborator

@ochafik ochafik left a comment

Choose a reason for hiding this comment

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

Thanks Anton!

Tools are associated with UI resources through the `_meta.ui` field:

```typescript
interface McpUiToolMeta {
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you add to spec.types.ts too?

inputSchema: object;
_meta?: {
// Required: URI of the UI resource to use for rendering
"ui/resourceUri"?: string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we keep this for now (don't need to break everyone) but deprecate it?

- `visibility` defaults to `["model"]` if omitted (standard MCP behavior)
- `"model"`: Tool is visible to and callable by the agent
- `"apps"`: Tool is callable by apps from the same server connection only
- Host MUST NOT include tools with `visibility: ["apps"]` in the agent's tool list
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- Host MUST NOT include tools with `visibility: ["apps"]` in the agent's tool list
- Host MUST NOT include tools in the agent's tool list when their visibility does not include `"model"` (e.g. `visibility: ["apps"]`)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Should also add a blurb about tools/list and tools/call, to say the former will skip tools that don't have "apps", and the latter will error when attempting to call such a tool anyway.

inputSchema: { /* ... */ },
_meta: {
"ui/resourceUri": "ui://weather-server/dashboard"
ui: { resourceUri: "ui://weather-server/dashboard" }
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a breaking change. Let's deprecate it and give consumers some time to adapt. We should remove it before GA.

/** URI of UI resource for rendering tool results */
resourceUri?: string;
/**
* Who can access this tool. Default: ["model"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* Who can access this tool. Default: ["model"]
* Who can access this tool. Default: ["model", "app"]

@antonpk1
Copy link
Collaborator Author

thanks folks, will address all the comments!

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