fix(desktop/ui): Set correct mcp-app host capabilities (#9116)

Signed-off-by: Cameron Yick <cameron.yick@datadoghq.com>
This commit is contained in:
Cameron Yick
2026-05-12 18:30:06 -04:00
committed by GitHub
parent 0b4214cf94
commit 014ddb84b0
@@ -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}