| 902 | }); |
| 903 | |
| 904 | const renderedInAppResult = (input: { |
| 905 | readonly code: string; |
| 906 | readonly artifactId: string; |
| 907 | readonly title: string; |
| 908 | readonly url?: string | undefined; |
| 909 | }): McpToolResult => ({ |
| 910 | content: [ |
| 911 | { |
| 912 | type: "text", |
| 913 | text: [ |
| 914 | `Rendered "${input.title}" as an interactive UI component. Saved as artifact ${input.artifactId}.`, |
| 915 | // The link rides along even though the widget rendered: clients lose |
| 916 | // rendered widgets in ways the server never sees (a transcript |
| 917 | // reopened without re-reading the ui:// resource shows raw JSON), and |
| 918 | // when that happens this URL in the conversation is the only path |
| 919 | // back to the artifact the model can offer. |
| 920 | ...(input.url ? [`It also stays available at ${input.url}`] : []), |
| 921 | ].join("\n"), |
| 922 | }, |
| 923 | ], |
| 924 | structuredContent: { |
| 925 | code: input.code, |
| 926 | artifactId: input.artifactId, |
| 927 | ...(input.url ? { url: input.url } : {}), |
| 928 | }, |
| 929 | }); |
| 930 | |
| 931 | const renderedAsLinkResult = (input: { |
| 932 | readonly url: string; |