fix: also name a tool's UI resource with the flat ui/resourceUri key

Some MCP Apps hosts read the earlier flat _meta key; the MCP Apps SDK sends
it alongside _meta.ui.resourceUri, and so does the adapter now.
This commit is contained in:
Sameh Khamis committed 2026-10-02 15:21:37 -07:00
1 parent 5775eb9053
commit ba751d9433
2 files changed
+9 -1

No files matched your search

+1
View File
@@ -233,6 +233,7 @@ test('resources are listed and read, and tools name their UI resource', async ()
});
assert.deepEqual((await call('tools/list')).tools[0]._meta, {
ui: { resourceUri: 'ui://fixture/view' },
'ui/resourceUri': 'ui://fixture/view',
});
assert.deepEqual((await call('resources/list')).resources, [
{
+8 -1
View File
@@ -40,7 +40,14 @@ export function toMcpTools(catalog, { descriptions = {}, decorate } = {}) {
inputSchema: tool.inputSchema,
annotations: { title, ...tool.annotations },
...(tool.ui
? { _meta: { ui: { resourceUri: tool.ui.resourceUri } } }
? {
// The flat key is the earlier form of the same field, which some
// hosts still read; the MCP Apps SDK sends both.
_meta: {
ui: { resourceUri: tool.ui.resourceUri },
'ui/resourceUri': tool.ui.resourceUri,
},
}
: {}),
};
return decorate