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[];
|
depends_on: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type UiMeta = {
|
||||||
|
ui?: {
|
||||||
|
resourceUri?: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
type ToolResultWithMeta = {
|
type ToolResultWithMeta = {
|
||||||
status?: string;
|
status?: string;
|
||||||
value?: CallToolResponse & {
|
value?: CallToolResponse & {
|
||||||
_meta?: {
|
_meta?: UiMeta;
|
||||||
'ui/resourceUri'?: string;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
type ToolRequestWithMeta = ToolRequestMessageContent & {
|
type ToolRequestWithMeta = ToolRequestMessageContent & {
|
||||||
_meta?: {
|
_meta?: UiMeta;
|
||||||
'ui/resourceUri'?: string;
|
|
||||||
};
|
|
||||||
toolCall: {
|
toolCall: {
|
||||||
status: 'success';
|
status: 'success';
|
||||||
value: {
|
value: {
|
||||||
@@ -85,12 +87,12 @@ function McpAppWrapper({
|
|||||||
append,
|
append,
|
||||||
}: McpAppWrapperProps): React.ReactNode {
|
}: McpAppWrapperProps): React.ReactNode {
|
||||||
const requestWithMeta = toolRequest as ToolRequestWithMeta;
|
const requestWithMeta = toolRequest as ToolRequestWithMeta;
|
||||||
let resourceUri = requestWithMeta._meta?.['ui/resourceUri'];
|
let resourceUri = requestWithMeta._meta?.ui?.resourceUri;
|
||||||
|
|
||||||
if (!resourceUri && toolResponse) {
|
if (!resourceUri && toolResponse) {
|
||||||
const resultWithMeta = toolResponse.toolResult as ToolResultWithMeta;
|
const resultWithMeta = toolResponse.toolResult as ToolResultWithMeta;
|
||||||
if (resultWithMeta?.status === 'success' && resultWithMeta.value) {
|
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