diff --git a/web-ui/src/lib/mcpCustomTools.ts b/web-ui/src/lib/mcpCustomTools.ts index 914a576..7757991 100644 --- a/web-ui/src/lib/mcpCustomTools.ts +++ b/web-ui/src/lib/mcpCustomTools.ts @@ -39,6 +39,8 @@ export type McpCustomToolsResolution = { source: 'artifacts_custom_tools' | 'services_operations' expoId: string serviceId: string + /** Control-plane artifact id when tools come from `RESHAPR_CUSTOM_TOOLS`. */ + artifactId?: string /** Full `RESHAPR_CUSTOM_TOOLS` artifact YAML when tools come from that artifact. */ artifactYaml?: string } @@ -225,6 +227,7 @@ type ServiceRow = { } type ArtifactRow = { + id?: string type?: string content?: string | null } @@ -291,6 +294,7 @@ export async function resolveMcpCustomToolsForService( source: 'artifacts_custom_tools', expoId: '', serviceId, + artifactId: yamlArtifact?.id, artifactYaml: yamlArtifact?.content ?? undefined, } } @@ -324,6 +328,7 @@ export async function resolveMcpCustomToolsForService( source: 'artifacts_custom_tools', expoId: expo.id, serviceId, + artifactId: yamlArtifact?.id, artifactYaml: yamlArtifact?.content ?? undefined, } } diff --git a/web-ui/src/lib/mcpPrompts.ts b/web-ui/src/lib/mcpPrompts.ts index 8f3c7cf..f9f90a3 100644 --- a/web-ui/src/lib/mcpPrompts.ts +++ b/web-ui/src/lib/mcpPrompts.ts @@ -28,6 +28,7 @@ export type McpPromptsClient = { } export type McpPromptArtifactYaml = { + id: string name: string content: string } @@ -49,6 +50,7 @@ type ServiceRow = { } type ArtifactRow = { + id?: string type?: string name?: string content?: string | null @@ -155,8 +157,8 @@ export async function resolveMcpPromptsForService( for (const artifact of promptArtifacts) { const label = artifact.name || `RESHAPR_PROMPTS-${artifactYamls.length + 1}` if (artifact.name) artifactNames.push(artifact.name) - if (artifact.content) { - artifactYamls.push({ name: label, content: artifact.content }) + if (artifact.content && artifact.id) { + artifactYamls.push({ id: artifact.id, name: label, content: artifact.content }) } for (const p of parseReshaprPromptsYaml(artifact.content || '')) { byName.set(p.name, p) diff --git a/web-ui/src/routes/(app)/mcp-custom-tools/+page.svelte b/web-ui/src/routes/(app)/mcp-custom-tools/+page.svelte index 31d8b45..c73ead8 100644 --- a/web-ui/src/routes/(app)/mcp-custom-tools/+page.svelte +++ b/web-ui/src/routes/(app)/mcp-custom-tools/+page.svelte @@ -45,6 +45,10 @@ const tools = $derived(result?.tools ?? []); + function artifactEditHref(serviceId: string, artifactId: string): string { + return `/services/${serviceId}/artifacts/${artifactId}`; + } + async function runResolve(url: string) { const trimmed = url.trim(); if (!trimmed) { @@ -276,7 +280,18 @@ {yamlOpen ? 'Hide' : 'Show'} - + + {#if result.artifactId} +
+ +
+ {/if}
diff --git a/web-ui/src/routes/(app)/mcp-prompts/+page.svelte b/web-ui/src/routes/(app)/mcp-prompts/+page.svelte index ca82bf8..12abf30 100644 --- a/web-ui/src/routes/(app)/mcp-prompts/+page.svelte +++ b/web-ui/src/routes/(app)/mcp-prompts/+page.svelte @@ -42,6 +42,14 @@ const prompts = $derived(result?.prompts ?? []); + function artifactEditHref(serviceId: string, artifactId: string): string { + return `/services/${serviceId}/artifacts/${artifactId}`; + } + + function artifactsHubHref(serviceId: string): string { + return `/services/${serviceId}/artifacts`; + } + async function runListPrompts(url: string) { const trimmed = url.trim(); if (!trimmed) { @@ -286,7 +294,12 @@ {:else} -

No prompts found in the artifact YAML.

+

+ No prompts found in the artifact YAML. + + Open Artifacts hub + +

{/if} {#if result.artifactYamls.length > 0} @@ -301,9 +314,18 @@ - {#each result.artifactYamls as artifact (artifact.name)} + {#each result.artifactYamls as artifact (artifact.id)}
-

{artifact.name}

+
+

{artifact.name}

+ +
void load()}>Refresh
+

+ Resolved from RESHAPR_CUSTOM_TOOLS artifacts or service operations. Edit YAML via + Artifacts. +

+ {#if error} {/if} @@ -108,7 +122,14 @@ {yamlOpen ? 'Hide' : 'Show'} RESHAPR_CUSTOM_TOOLS YAML - + + {#if result.artifactId} +
+ +
+ {/if}
@@ -129,7 +150,14 @@ {:else if tools.length === 0} - No custom tools resolved. + + No custom tools resolved. + {#if !loading && result && result.source === 'services_operations'} + + Create CustomTools artifact + + {/if} + {:else} {#each tools as t (t.name)} diff --git a/web-ui/src/routes/(app)/services/[id]/mcp-prompts/+page.svelte b/web-ui/src/routes/(app)/services/[id]/mcp-prompts/+page.svelte index d688c6f..849b37d 100644 --- a/web-ui/src/routes/(app)/services/[id]/mcp-prompts/+page.svelte +++ b/web-ui/src/routes/(app)/services/[id]/mcp-prompts/+page.svelte @@ -36,6 +36,13 @@ const prompts = $derived(result?.prompts ?? []); + const artifactsHubHref = $derived(`/services/${ctx.id}/artifacts`); + const createPromptsHref = $derived(`/services/${ctx.id}/artifacts/new?kind=${encodeURIComponent('Prompts')}`); + + function artifactEditHref(artifactId: string): string { + return `/services/${ctx.id}/artifacts/${artifactId}`; + } + function formatArguments( args: { name: string; description?: string; required?: boolean }[] | undefined, ): string { @@ -77,7 +84,7 @@

Resolved from RESHAPR_PROMPTS artifacts on this service. Attach prompts via - Artifacts. + Artifacts.

{#if error} @@ -100,9 +107,14 @@ {yamlOpen ? 'Hide' : 'Show'} artifact YAML - {#each result.artifactYamls as art (art.name)} + {#each result.artifactYamls as art (art.id)}
-

{art.name}

+
+

{art.name}

+ +
{/each} @@ -126,7 +138,12 @@ {:else if prompts.length === 0} - No prompts. + + No prompts. + {#if !loading && result && result.artifactYamls.length === 0} + Create Prompts artifact + {/if} + {:else} {#each prompts as p (p.name)}