fix: update MCP Apps _meta.ui.resourceUri to use nested format (SEP-1865) (#6372)
This commit is contained in:
@@ -24,19 +24,21 @@ interface ToolGraphNode {
|
||||
depends_on: number[];
|
||||
}
|
||||
|
||||
type UiMeta = {
|
||||
ui?: {
|
||||
resourceUri?: string;
|
||||
};
|
||||
};
|
||||
|
||||
type ToolResultWithMeta = {
|
||||
status?: string;
|
||||
value?: CallToolResponse & {
|
||||
_meta?: {
|
||||
'ui/resourceUri'?: string;
|
||||
};
|
||||
_meta?: UiMeta;
|
||||
};
|
||||
};
|
||||
|
||||
type ToolRequestWithMeta = ToolRequestMessageContent & {
|
||||
_meta?: {
|
||||
'ui/resourceUri'?: string;
|
||||
};
|
||||
_meta?: UiMeta;
|
||||
toolCall: {
|
||||
status: 'success';
|
||||
value: {
|
||||
@@ -85,12 +87,12 @@ function McpAppWrapper({
|
||||
append,
|
||||
}: McpAppWrapperProps): React.ReactNode {
|
||||
const requestWithMeta = toolRequest as ToolRequestWithMeta;
|
||||
let resourceUri = requestWithMeta._meta?.['ui/resourceUri'];
|
||||
let resourceUri = requestWithMeta._meta?.ui?.resourceUri;
|
||||
|
||||
if (!resourceUri && toolResponse) {
|
||||
const resultWithMeta = toolResponse.toolResult as ToolResultWithMeta;
|
||||
if (resultWithMeta?.status === 'success' && resultWithMeta.value) {
|
||||
resourceUri = resultWithMeta.value._meta?.['ui/resourceUri'];
|
||||
resourceUri = resultWithMeta.value._meta?.ui?.resourceUri;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user