| 1211 | }); |
| 1212 | |
| 1213 | const artifactListResult = (artifacts: readonly ArtifactSummary[]): McpToolResult => { |
| 1214 | const items = artifacts.map((artifact) => ({ |
| 1215 | id: artifact.id, |
| 1216 | title: artifact.title, |
| 1217 | description: artifact.description, |
| 1218 | updatedAt: artifact.updatedAt.toISOString(), |
| 1219 | })); |
| 1220 | const text = |
| 1221 | items.length === 0 |
| 1222 | ? "No saved artifacts yet. Use create-artifact to make one." |
| 1223 | : [ |
| 1224 | "Saved artifacts:", |
| 1225 | ...items.map( |
| 1226 | (item) => |
| 1227 | `- ${item.id} — ${item.title}${item.description ? `: ${item.description}` : ""} (updated ${item.updatedAt})`, |
| 1228 | ), |
| 1229 | ].join("\n"); |
| 1230 | return { content: [{ type: "text", text }], structuredContent: { artifacts: items } }; |
| 1231 | }; |
| 1232 | |
| 1233 | const artifactNotFoundResult = (id: string): McpToolResult => ({ |
| 1234 | content: [ |