-
Notifications
You must be signed in to change notification settings - Fork 39
docs: add tool visibility and restructure _meta.ui #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- 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]>
commit: |
ochafik
left a comment
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - 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"]`) |
There was a problem hiding this comment.
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" } |
There was a problem hiding this comment.
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"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * Who can access this tool. Default: ["model"] | |
| * Who can access this tool. Default: ["model", "app"] |
|
thanks folks, will address all the comments! |
Summary
Adds tool visibility control and restructures tool metadata for cleaner API.
Changes
1. Restructured
_metaformat:2. Added
visibilityarray:["model"]["apps"]["model", "apps"]3. Key behaviors:
["apps"]scope is per-server (cross-server calls blocked)tools/callfor tools without"apps"visibilityWhy single
visibilityvs OpenAI's two fields?OpenAI uses
widgetAccessible+visibilityseparately. We use one array because:Discussion points for meeting
["model"]the right default? (preserves standard MCP behavior)🤖 Generated with Claude Code