mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
fix(desktop/ui): Set correct mcp-app host capabilities (#9116)
Signed-off-by: Cameron Yick <cameron.yick@datadoghq.com>
This commit is contained in:
@@ -93,6 +93,22 @@ function getDeviceCapabilities(): NonNullable<
|
||||
};
|
||||
}
|
||||
|
||||
// Derives https://github.com/modelcontextprotocol/ext-apps/blob/1d091e21321c0680564f19fea9c82a805a352a9c/src/spec.types.ts#L494
|
||||
// from the handlers passed to <AppRenderer>, keeping advertised capabilities in sync with what the host supports.
|
||||
function buildHostCapabilities(handlers: {
|
||||
onCallTool?: unknown;
|
||||
onOpenLink?: unknown;
|
||||
onReadResource?: unknown;
|
||||
onSendMessage?: unknown;
|
||||
}) {
|
||||
return {
|
||||
...(handlers.onCallTool !== undefined && { serverTools: {} }),
|
||||
...(handlers.onOpenLink !== undefined && { openLinks: {} }),
|
||||
...(handlers.onReadResource !== undefined && { serverResources: {} }),
|
||||
...(handlers.onSendMessage !== undefined && { message: { text: {} } }),
|
||||
};
|
||||
}
|
||||
|
||||
function buildHostContextToolInfo(payload: McpAppPayload): HostContextToolInfo {
|
||||
const tool: HostContextTool = {
|
||||
name: payload.tool.name,
|
||||
@@ -426,6 +442,12 @@ export function McpAppView({
|
||||
toolInput={currentToolInput}
|
||||
toolResult={currentToolResult}
|
||||
hostContext={hostContext}
|
||||
hostCapabilities={buildHostCapabilities({
|
||||
onCallTool: handleCallTool,
|
||||
onOpenLink: handleOpenLink,
|
||||
onReadResource: handleReadResource,
|
||||
onSendMessage: onSendMessage,
|
||||
})}
|
||||
onOpenLink={handleOpenLink}
|
||||
onMessage={handleMessage}
|
||||
onCallTool={handleCallTool}
|
||||
|
||||
Reference in New Issue
Block a user