@_davideast/stitch-mcp 0.5.5 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-0xbbvsve.js +370 -0
- package/dist/chunk-0xbbvsve.js.map +16 -0
- package/dist/chunk-11ab03kg.js +137 -0
- package/dist/chunk-11ab03kg.js.map +10 -0
- package/dist/chunk-17cs61t4.js +270 -0
- package/dist/chunk-17cs61t4.js.map +10 -0
- package/dist/chunk-1mz7188j.js +20 -0
- package/dist/chunk-1mz7188j.js.map +9 -0
- package/dist/chunk-1txb8kjb.js +17 -0
- package/dist/chunk-1txb8kjb.js.map +9 -0
- package/dist/chunk-1v5q6d3n.js +17 -0
- package/dist/chunk-1v5q6d3n.js.map +9 -0
- package/dist/chunk-1wcg0pjg.js +94 -0
- package/dist/chunk-1wcg0pjg.js.map +10 -0
- package/dist/chunk-2zp03jky.js +19 -0
- package/dist/chunk-2zp03jky.js.map +9 -0
- package/dist/chunk-441ntz7a.js +137 -0
- package/dist/chunk-441ntz7a.js.map +10 -0
- package/dist/chunk-543135qd.js +43679 -0
- package/dist/chunk-543135qd.js.map +234 -0
- package/dist/chunk-564wpgj7.js +246 -0
- package/dist/chunk-564wpgj7.js.map +14 -0
- package/dist/chunk-5jbenaez.js +19185 -0
- package/dist/chunk-5jbenaez.js.map +115 -0
- package/dist/chunk-633ma50k.js +371 -0
- package/dist/chunk-633ma50k.js.map +16 -0
- package/dist/chunk-7ryqstaa.js +7065 -0
- package/dist/chunk-7ryqstaa.js.map +115 -0
- package/dist/chunk-7z5z40ar.js +165 -0
- package/dist/chunk-7z5z40ar.js.map +10 -0
- package/dist/chunk-86gwwcyr.js +46325 -0
- package/dist/chunk-86gwwcyr.js.map +261 -0
- package/dist/chunk-8gegrmmt.js +256 -0
- package/dist/chunk-8gegrmmt.js.map +11 -0
- package/dist/chunk-8hgrrc49.js +17 -0
- package/dist/chunk-8hgrrc49.js.map +9 -0
- package/dist/chunk-8w97w2wa.js +50 -0
- package/dist/chunk-8w97w2wa.js.map +9 -0
- package/dist/chunk-8yfetpqq.js +19132 -0
- package/dist/chunk-8yfetpqq.js.map +115 -0
- package/dist/chunk-94knm2sw.js +1495 -0
- package/dist/chunk-94knm2sw.js.map +23 -0
- package/dist/chunk-9ckyz47q.js +518 -0
- package/dist/chunk-9ckyz47q.js.map +12 -0
- package/dist/chunk-appd0sxm.js +5217 -0
- package/dist/chunk-appd0sxm.js.map +67 -0
- package/dist/chunk-b9atzag0.js +67 -0
- package/dist/chunk-b9atzag0.js.map +10 -0
- package/dist/chunk-c08qy4ty.js +67 -0
- package/dist/chunk-c08qy4ty.js.map +10 -0
- package/dist/chunk-c5dtqvff.js +11 -0
- package/dist/chunk-c5dtqvff.js.map +9 -0
- package/dist/chunk-d1ea3tmp.js +17 -0
- package/dist/chunk-d1ea3tmp.js.map +9 -0
- package/dist/chunk-ecn1ca83.js +34253 -0
- package/dist/chunk-ecn1ca83.js.map +261 -0
- package/dist/chunk-ef1c6gq5.js +947 -0
- package/dist/chunk-ef1c6gq5.js.map +28 -0
- package/dist/chunk-ef355a3f.js +20 -0
- package/dist/chunk-ef355a3f.js.map +9 -0
- package/dist/chunk-f0dt9hv8.js +680 -0
- package/dist/chunk-f0dt9hv8.js.map +17 -0
- package/dist/chunk-f2aj8ff8.js +11 -0
- package/dist/chunk-f2aj8ff8.js.map +9 -0
- package/dist/chunk-f3wp07zw.js +24 -0
- package/dist/chunk-f3wp07zw.js.map +9 -0
- package/dist/chunk-f5wqd3z3.js +10 -0
- package/dist/chunk-f5wqd3z3.js.map +9 -0
- package/dist/chunk-g8hwy0wx.js +504 -0
- package/dist/chunk-g8hwy0wx.js.map +21 -0
- package/dist/chunk-gcx3c3yc.js +680 -0
- package/dist/chunk-gcx3c3yc.js.map +17 -0
- package/dist/chunk-gq6vxp70.js +202 -0
- package/dist/chunk-gq6vxp70.js.map +13 -0
- package/dist/chunk-gw64p5pg.js +164 -0
- package/dist/chunk-gw64p5pg.js.map +10 -0
- package/dist/chunk-hgv5frj1.js +256 -0
- package/dist/chunk-hgv5frj1.js.map +11 -0
- package/dist/chunk-hst78da7.js +87 -0
- package/dist/chunk-hst78da7.js.map +13 -0
- package/dist/chunk-hsxpgjyd.js +256 -0
- package/dist/chunk-hsxpgjyd.js.map +11 -0
- package/dist/chunk-j1v44zzm.js +109 -0
- package/dist/chunk-j1v44zzm.js.map +10 -0
- package/dist/chunk-jfd5md63.js +736 -0
- package/dist/chunk-jfd5md63.js.map +16 -0
- package/dist/chunk-jn5pcnz9.js +270 -0
- package/dist/chunk-jn5pcnz9.js.map +10 -0
- package/dist/chunk-jvhzgyhy.js +62 -0
- package/dist/chunk-jvhzgyhy.js.map +10 -0
- package/dist/chunk-k86st2r8.js +7 -0
- package/dist/chunk-k86st2r8.js.map +9 -0
- package/dist/chunk-kztccppz.js +606 -0
- package/dist/chunk-kztccppz.js.map +15 -0
- package/dist/chunk-m2vk15q9.js +503 -0
- package/dist/chunk-m2vk15q9.js.map +21 -0
- package/dist/chunk-mk40f3ka.js +31529 -0
- package/dist/chunk-mk40f3ka.js.map +245 -0
- package/dist/chunk-mp1sf8x6.js +264 -0
- package/dist/chunk-mp1sf8x6.js.map +12 -0
- package/dist/chunk-mzyqavzd.js +736 -0
- package/dist/chunk-mzyqavzd.js.map +16 -0
- package/dist/chunk-n9fs543g.js +94 -0
- package/dist/chunk-n9fs543g.js.map +10 -0
- package/dist/chunk-nbbwjw90.js +165 -0
- package/dist/chunk-nbbwjw90.js.map +10 -0
- package/dist/chunk-nh14pn95.js +137 -0
- package/dist/chunk-nh14pn95.js.map +10 -0
- package/dist/chunk-qnd877d5.js +947 -0
- package/dist/chunk-qnd877d5.js.map +28 -0
- package/dist/chunk-rng2ypf7.js +538 -0
- package/dist/chunk-rng2ypf7.js.map +15 -0
- package/dist/chunk-sjq10wbw.js +39 -0
- package/dist/chunk-sjq10wbw.js.map +9 -0
- package/dist/chunk-snv6a65k.js +759 -0
- package/dist/chunk-snv6a65k.js.map +19 -0
- package/dist/chunk-sqhdg0mf.js +2138 -0
- package/dist/chunk-sqhdg0mf.js.map +44 -0
- package/dist/chunk-tebher8z.js +514 -0
- package/dist/chunk-tebher8z.js.map +12 -0
- package/dist/chunk-v0wtyr4k.js +66 -0
- package/dist/chunk-v0wtyr4k.js.map +10 -0
- package/dist/chunk-v20274k8.js +246 -0
- package/dist/chunk-v20274k8.js.map +14 -0
- package/dist/chunk-vcp9fp2w.js +839 -0
- package/dist/chunk-vcp9fp2w.js.map +11 -0
- package/dist/chunk-vz737k5f.js +269 -0
- package/dist/chunk-vz737k5f.js.map +10 -0
- package/dist/chunk-x6bsgeqa.js +736 -0
- package/dist/chunk-x6bsgeqa.js.map +16 -0
- package/dist/chunk-xg9kcbp1.js +371 -0
- package/dist/chunk-xg9kcbp1.js.map +16 -0
- package/dist/chunk-xhad5b8x.js +110 -0
- package/dist/chunk-xhad5b8x.js.map +10 -0
- package/dist/chunk-xkwa1mn5.js +203 -0
- package/dist/chunk-xkwa1mn5.js.map +13 -0
- package/dist/chunk-xtcg74kf.js +50 -0
- package/dist/chunk-xtcg74kf.js.map +9 -0
- package/dist/chunk-xzjkaqe9.js +759 -0
- package/dist/chunk-xzjkaqe9.js.map +19 -0
- package/dist/chunk-y65xgj69.js +1495 -0
- package/dist/chunk-y65xgj69.js.map +23 -0
- package/dist/commands/doctor/command.js +1 -1
- package/dist/commands/init/command.js +1 -1
- package/dist/commands/logout/command.js +1 -1
- package/dist/commands/proxy/LoggingCallToolHandler.d.ts +11 -0
- package/dist/commands/proxy/command.js +1 -1
- package/dist/commands/screens/command.js +4 -4
- package/dist/commands/serve/command.js +5 -5
- package/dist/commands/site/command.js +1 -1
- package/dist/commands/snapshot/command.js +1 -1
- package/dist/commands/tool/command.js +1 -1
- package/dist/commands/tool/steps/LogExecuteToolStep.d.ts +19 -0
- package/dist/commands/upload/command.d.ts +2 -0
- package/dist/commands/upload/command.js +77 -0
- package/dist/commands/upload/command.js.map +11 -0
- package/dist/commands/upload/handler.d.ts +20 -0
- package/dist/commands/upload/spec.d.ts +38 -0
- package/dist/commands/view/command.js +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/lib/log/append.d.ts +12 -0
- package/dist/lib/log/blob-store/handler.d.ts +10 -0
- package/dist/lib/log/blob-store/spec.d.ts +251 -0
- package/dist/lib/log/capture/handler.d.ts +10 -0
- package/dist/lib/log/capture/spec.d.ts +1504 -0
- package/dist/lib/log/factory.d.ts +4 -0
- package/package.json +2 -2
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createCaptureHandler,
|
|
3
|
+
isLogEnabled
|
|
4
|
+
} from "./chunk-kztccppz.js";
|
|
5
|
+
import {
|
|
6
|
+
fetchWithRetry
|
|
7
|
+
} from "./chunk-6gw9apqb.js";
|
|
8
|
+
import {
|
|
9
|
+
pLimit
|
|
10
|
+
} from "./chunk-a5xra9jn.js";
|
|
11
|
+
import {
|
|
12
|
+
downloadText
|
|
13
|
+
} from "./chunk-fkzq5m59.js";
|
|
14
|
+
import {
|
|
15
|
+
CallToolResultSchema,
|
|
16
|
+
StitchToolClient,
|
|
17
|
+
stitch
|
|
18
|
+
} from "./chunk-ecn1ca83.js";
|
|
19
|
+
import"./chunk-543135qd.js";
|
|
20
|
+
import {
|
|
21
|
+
runSteps
|
|
22
|
+
} from "./chunk-f2hq6bfv.js";
|
|
23
|
+
import"./chunk-c6ge431q.js";
|
|
24
|
+
import"./chunk-9wyra8hs.js";
|
|
25
|
+
|
|
26
|
+
// src/commands/tool/virtual-tools/get-screen-code.ts
|
|
27
|
+
var getScreenCodeTool = {
|
|
28
|
+
name: "get_screen_code",
|
|
29
|
+
description: "(Virtual) Retrieves a screen and downloads its HTML code content.",
|
|
30
|
+
inputSchema: {
|
|
31
|
+
type: "object",
|
|
32
|
+
properties: {
|
|
33
|
+
projectId: {
|
|
34
|
+
type: "string",
|
|
35
|
+
description: "Required. The project ID of screen to retrieve."
|
|
36
|
+
},
|
|
37
|
+
screenId: {
|
|
38
|
+
type: "string",
|
|
39
|
+
description: "Required. The name of screen to retrieve."
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
required: ["projectId", "screenId"]
|
|
43
|
+
},
|
|
44
|
+
execute: async (client, args, stitch2) => {
|
|
45
|
+
if (!stitch2)
|
|
46
|
+
throw new Error("get_screen_code requires a Stitch instance");
|
|
47
|
+
const { projectId, screenId } = args;
|
|
48
|
+
const screen = await stitch2.project(projectId).getScreen(screenId);
|
|
49
|
+
let htmlContent = null;
|
|
50
|
+
try {
|
|
51
|
+
const htmlUrl = await screen.getHtml();
|
|
52
|
+
if (htmlUrl) {
|
|
53
|
+
htmlContent = await downloadText(htmlUrl);
|
|
54
|
+
}
|
|
55
|
+
} catch (e) {
|
|
56
|
+
console.error(`Error downloading HTML code: ${e}`);
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
screenId: screen.screenId,
|
|
60
|
+
projectId: screen.projectId,
|
|
61
|
+
htmlContent
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
// src/commands/tool/virtual-tools/get-screen-image.ts
|
|
66
|
+
var getScreenImageTool = {
|
|
67
|
+
name: "get_screen_image",
|
|
68
|
+
description: "(Virtual) Retrieves a screen and downloads its screenshot image content.",
|
|
69
|
+
inputSchema: {
|
|
70
|
+
type: "object",
|
|
71
|
+
properties: {
|
|
72
|
+
projectId: {
|
|
73
|
+
type: "string",
|
|
74
|
+
description: "Required. The project ID of screen to retrieve."
|
|
75
|
+
},
|
|
76
|
+
screenId: {
|
|
77
|
+
type: "string",
|
|
78
|
+
description: "Required. The name of screen to retrieve."
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
required: ["projectId", "screenId"]
|
|
82
|
+
},
|
|
83
|
+
execute: async (client, args, stitch2) => {
|
|
84
|
+
if (!stitch2)
|
|
85
|
+
throw new Error("get_screen_image requires a Stitch instance");
|
|
86
|
+
const { projectId, screenId } = args;
|
|
87
|
+
const screen = await stitch2.project(projectId).getScreen(screenId);
|
|
88
|
+
let imageContent = null;
|
|
89
|
+
try {
|
|
90
|
+
const imageUrl = await screen.getImage();
|
|
91
|
+
if (imageUrl) {
|
|
92
|
+
const response = await fetch(imageUrl);
|
|
93
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
94
|
+
const buffer = Buffer.from(arrayBuffer);
|
|
95
|
+
imageContent = buffer.toString("base64");
|
|
96
|
+
}
|
|
97
|
+
} catch (e) {
|
|
98
|
+
console.error(`Error downloading screenshot: ${e}`);
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
screenId: screen.screenId,
|
|
102
|
+
projectId: screen.projectId,
|
|
103
|
+
imageContent
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
// src/commands/tool/virtual-tools/build-site.ts
|
|
108
|
+
var buildSiteTool = {
|
|
109
|
+
name: "build_site",
|
|
110
|
+
description: "(Virtual) Builds a site from a Stitch project by mapping screens to routes. Returns the design HTML for each page to use as context for code generation.",
|
|
111
|
+
inputSchema: {
|
|
112
|
+
type: "object",
|
|
113
|
+
properties: {
|
|
114
|
+
projectId: {
|
|
115
|
+
type: "string",
|
|
116
|
+
description: "Required. The project ID to build a site from."
|
|
117
|
+
},
|
|
118
|
+
routes: {
|
|
119
|
+
type: "array",
|
|
120
|
+
description: "Required. Array of screen-to-route mappings.",
|
|
121
|
+
items: {
|
|
122
|
+
type: "object",
|
|
123
|
+
properties: {
|
|
124
|
+
screenId: {
|
|
125
|
+
type: "string",
|
|
126
|
+
description: "The screen ID to use for this route."
|
|
127
|
+
},
|
|
128
|
+
route: {
|
|
129
|
+
type: "string",
|
|
130
|
+
description: 'The route path (e.g. "/" or "/about").'
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
required: ["screenId", "route"]
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
required: ["projectId", "routes"]
|
|
138
|
+
},
|
|
139
|
+
execute: async (client, args, stitch2) => {
|
|
140
|
+
if (!stitch2)
|
|
141
|
+
throw new Error("build_site requires a Stitch instance");
|
|
142
|
+
const { projectId, routes } = args;
|
|
143
|
+
if (!Array.isArray(routes)) {
|
|
144
|
+
throw new Error("routes must be an array");
|
|
145
|
+
}
|
|
146
|
+
if (routes.length === 0) {
|
|
147
|
+
throw new Error("routes must be a non-empty array");
|
|
148
|
+
}
|
|
149
|
+
for (const entry of routes) {
|
|
150
|
+
if (!entry.screenId || typeof entry.screenId !== "string") {
|
|
151
|
+
throw new Error('Each route entry must have a "screenId" string');
|
|
152
|
+
}
|
|
153
|
+
if (!entry.route || typeof entry.route !== "string") {
|
|
154
|
+
throw new Error('Each route entry must have a "route" string');
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const routePaths = routes.map((r) => r.route);
|
|
158
|
+
const uniqueRoutes = new Set(routePaths);
|
|
159
|
+
if (uniqueRoutes.size !== routePaths.length) {
|
|
160
|
+
const duplicates = routePaths.filter((r, i) => routePaths.indexOf(r) !== i);
|
|
161
|
+
throw new Error(`Duplicate route paths found: ${[...new Set(duplicates)].join(", ")}`);
|
|
162
|
+
}
|
|
163
|
+
const project = stitch2.project(projectId);
|
|
164
|
+
const sdkScreens = await project.screens();
|
|
165
|
+
const screenMap = new Map(sdkScreens.map((s) => [s.screenId, s]));
|
|
166
|
+
const missingIds = routes.map((r) => r.screenId).filter((id) => !screenMap.has(id));
|
|
167
|
+
if (missingIds.length > 0) {
|
|
168
|
+
throw new Error(`Screen IDs not found in project: ${missingIds.join(", ")}`);
|
|
169
|
+
}
|
|
170
|
+
const limit = pLimit(3);
|
|
171
|
+
const htmlContent = new Map;
|
|
172
|
+
const errors = [];
|
|
173
|
+
await Promise.all(routes.map((r) => limit(async () => {
|
|
174
|
+
const screen = screenMap.get(r.screenId);
|
|
175
|
+
try {
|
|
176
|
+
const htmlUrl = await screen.getHtml();
|
|
177
|
+
if (htmlUrl) {
|
|
178
|
+
const html = await fetchWithRetry(htmlUrl);
|
|
179
|
+
htmlContent.set(r.screenId, html);
|
|
180
|
+
} else {
|
|
181
|
+
htmlContent.set(r.screenId, "");
|
|
182
|
+
}
|
|
183
|
+
} catch (e) {
|
|
184
|
+
errors.push(`${r.screenId}: ${e.message}`);
|
|
185
|
+
}
|
|
186
|
+
})));
|
|
187
|
+
if (errors.length > 0) {
|
|
188
|
+
throw new Error(`Failed to fetch HTML for screens: ${errors.join("; ")}`);
|
|
189
|
+
}
|
|
190
|
+
const pages = routes.map((r) => ({
|
|
191
|
+
screenId: r.screenId,
|
|
192
|
+
route: r.route,
|
|
193
|
+
title: screenMap.get(r.screenId).title ?? r.screenId,
|
|
194
|
+
html: htmlContent.get(r.screenId)
|
|
195
|
+
}));
|
|
196
|
+
return {
|
|
197
|
+
success: true,
|
|
198
|
+
pages,
|
|
199
|
+
message: `Built ${pages.length} page(s) with design HTML`
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
// src/commands/tool/virtual-tools/list-tools.ts
|
|
204
|
+
var listToolsTool = {
|
|
205
|
+
name: "list_tools",
|
|
206
|
+
description: "List all available tools with their descriptions and schemas.",
|
|
207
|
+
inputSchema: {
|
|
208
|
+
type: "object",
|
|
209
|
+
properties: {}
|
|
210
|
+
},
|
|
211
|
+
execute: async (client, _args) => {
|
|
212
|
+
const result = await client.listTools();
|
|
213
|
+
return result.tools || [];
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
// src/commands/tool/virtual-tools/index.ts
|
|
217
|
+
var virtualTools = [
|
|
218
|
+
getScreenCodeTool,
|
|
219
|
+
getScreenImageTool,
|
|
220
|
+
buildSiteTool,
|
|
221
|
+
listToolsTool
|
|
222
|
+
];
|
|
223
|
+
|
|
224
|
+
// src/commands/tool/steps/ListToolsStep.ts
|
|
225
|
+
class ListToolsStep {
|
|
226
|
+
id = "list-tools";
|
|
227
|
+
name = "List available tools";
|
|
228
|
+
async shouldRun(context) {
|
|
229
|
+
const name = context.input.toolName?.toLowerCase();
|
|
230
|
+
return !name || name === "list" || name === "listtools" || name === "list_tools";
|
|
231
|
+
}
|
|
232
|
+
async run(context) {
|
|
233
|
+
const result = await context.client.listTools();
|
|
234
|
+
const serverTools = result.tools || [];
|
|
235
|
+
const tools = [
|
|
236
|
+
...context.virtualTools.map((t) => ({ name: t.name, description: t.description, inputSchema: t.inputSchema, virtual: true })),
|
|
237
|
+
...serverTools.map((t) => ({ ...t, virtual: false }))
|
|
238
|
+
];
|
|
239
|
+
context.result = { success: true, data: tools };
|
|
240
|
+
return { success: true };
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// src/commands/tool/steps/ShowSchemaStep.ts
|
|
245
|
+
class ShowSchemaStep {
|
|
246
|
+
id = "show-schema";
|
|
247
|
+
name = "Show tool schema";
|
|
248
|
+
async shouldRun(context) {
|
|
249
|
+
return !!context.input.toolName && context.input.toolName !== "list" && context.input.showSchema;
|
|
250
|
+
}
|
|
251
|
+
async run(context) {
|
|
252
|
+
const toolName = context.input.toolName;
|
|
253
|
+
const result = await context.client.listTools();
|
|
254
|
+
const serverTools = result.tools || [];
|
|
255
|
+
const allTools = [...context.virtualTools, ...serverTools];
|
|
256
|
+
const tool = allTools.find((t) => t.name === toolName);
|
|
257
|
+
if (!tool) {
|
|
258
|
+
context.result = { success: false, error: `Tool not found: ${toolName}` };
|
|
259
|
+
return { success: false, error: new Error(`Tool not found: ${toolName}`) };
|
|
260
|
+
}
|
|
261
|
+
context.result = { success: true, data: this.formatSchema(tool) };
|
|
262
|
+
return { success: true };
|
|
263
|
+
}
|
|
264
|
+
formatSchema(tool) {
|
|
265
|
+
const schema = tool.inputSchema;
|
|
266
|
+
const args = {};
|
|
267
|
+
if (schema?.properties) {
|
|
268
|
+
for (const [key, prop] of Object.entries(schema.properties)) {
|
|
269
|
+
const required = schema.required?.includes(key) ? "(required)" : "(optional)";
|
|
270
|
+
args[key] = `${prop.type} ${required}${prop.description ? " - " + prop.description : ""}`;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return {
|
|
274
|
+
name: tool.name,
|
|
275
|
+
description: tool.description,
|
|
276
|
+
virtual: tool.virtual ?? false,
|
|
277
|
+
arguments: args,
|
|
278
|
+
example: this.generateExample(tool)
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
generateExample(tool) {
|
|
282
|
+
const exampleArgs = {};
|
|
283
|
+
if (tool.inputSchema?.properties) {
|
|
284
|
+
for (const [key, prop] of Object.entries(tool.inputSchema.properties)) {
|
|
285
|
+
exampleArgs[key] = prop.type === "string" ? `<${key}>` : `<${prop.type}>`;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return `stitch-mcp tool ${tool.name} -d '${JSON.stringify(exampleArgs)}'`;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// src/commands/tool/steps/ParseArgsStep.ts
|
|
293
|
+
class ParseArgsStep {
|
|
294
|
+
id = "parse-args";
|
|
295
|
+
name = "Parse tool arguments";
|
|
296
|
+
async shouldRun(context) {
|
|
297
|
+
return !!context.input.toolName && context.input.toolName !== "list" && !context.input.showSchema;
|
|
298
|
+
}
|
|
299
|
+
async run(context) {
|
|
300
|
+
let args = {};
|
|
301
|
+
if (context.input.data) {
|
|
302
|
+
args = JSON.parse(context.input.data);
|
|
303
|
+
} else if (context.input.dataFile) {
|
|
304
|
+
const content = await Bun.file(context.input.dataFile.replace("@", "")).text();
|
|
305
|
+
args = JSON.parse(content);
|
|
306
|
+
}
|
|
307
|
+
context.parsedArgs = args;
|
|
308
|
+
return { success: true };
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// src/commands/tool/steps/ValidateToolStep.ts
|
|
313
|
+
class ValidateToolStep {
|
|
314
|
+
id = "validate-tool";
|
|
315
|
+
name = "Validate tool exists";
|
|
316
|
+
async shouldRun(context) {
|
|
317
|
+
return !!context.input.toolName && context.input.toolName !== "list" && !context.input.showSchema && context.parsedArgs !== undefined;
|
|
318
|
+
}
|
|
319
|
+
async run(context) {
|
|
320
|
+
const toolName = context.input.toolName;
|
|
321
|
+
const result = await context.client.listTools();
|
|
322
|
+
const serverTools = result.tools || [];
|
|
323
|
+
const allTools = [...context.virtualTools, ...serverTools];
|
|
324
|
+
const found = allTools.find((t) => t.name === toolName);
|
|
325
|
+
if (!found) {
|
|
326
|
+
const availableNames = allTools.map((t) => t.name).sort();
|
|
327
|
+
context.result = {
|
|
328
|
+
success: false,
|
|
329
|
+
error: `Tool not found: "${toolName}". Use "list_tools" to see available tools.`,
|
|
330
|
+
data: {
|
|
331
|
+
requestedTool: toolName,
|
|
332
|
+
availableTools: availableNames,
|
|
333
|
+
hint: 'Call "list_tools" to see all available tools with descriptions and schemas.'
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
return { success: false, error: new Error(`Tool not found: ${toolName}`) };
|
|
337
|
+
}
|
|
338
|
+
return { success: true };
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// src/commands/tool/steps/ExecuteToolStep.ts
|
|
343
|
+
class ExecuteToolStep {
|
|
344
|
+
id = "execute-tool";
|
|
345
|
+
name = "Execute tool";
|
|
346
|
+
async shouldRun(context) {
|
|
347
|
+
return context.parsedArgs !== undefined;
|
|
348
|
+
}
|
|
349
|
+
async run(context) {
|
|
350
|
+
const toolName = context.input.toolName;
|
|
351
|
+
const args = context.parsedArgs;
|
|
352
|
+
const virtualTool = context.virtualTools.find((t) => t.name === toolName);
|
|
353
|
+
if (virtualTool) {
|
|
354
|
+
try {
|
|
355
|
+
const result2 = await virtualTool.execute(context.client, args, context.stitch);
|
|
356
|
+
context.result = { success: true, data: result2 };
|
|
357
|
+
return { success: true };
|
|
358
|
+
} catch (e) {
|
|
359
|
+
context.result = { success: false, error: `Virtual tool execution failed: ${e.message || String(e)}` };
|
|
360
|
+
return { success: false, error: e };
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
const result = await context.client.callTool(toolName, args);
|
|
364
|
+
context.result = { success: true, data: result };
|
|
365
|
+
return { success: true };
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// src/commands/tool/steps/LogExecuteToolStep.ts
|
|
370
|
+
class LogExecuteToolStep {
|
|
371
|
+
capture;
|
|
372
|
+
id = "execute-tool";
|
|
373
|
+
name = "Execute tool (with capture)";
|
|
374
|
+
constructor(capture) {
|
|
375
|
+
this.capture = capture;
|
|
376
|
+
}
|
|
377
|
+
async shouldRun(context) {
|
|
378
|
+
return context.parsedArgs !== undefined;
|
|
379
|
+
}
|
|
380
|
+
async run(context) {
|
|
381
|
+
const tool = context.input.toolName;
|
|
382
|
+
const args = context.parsedArgs;
|
|
383
|
+
const virtualTool = context.virtualTools.find((t) => t.name === tool);
|
|
384
|
+
if (virtualTool) {
|
|
385
|
+
try {
|
|
386
|
+
const result = await virtualTool.execute(context.client, args, context.stitch);
|
|
387
|
+
context.result = { success: true, data: result };
|
|
388
|
+
return { success: true };
|
|
389
|
+
} catch (e) {
|
|
390
|
+
context.result = { success: false, error: `Virtual tool execution failed: ${e.message || String(e)}` };
|
|
391
|
+
return { success: false, error: e };
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
const stitch2 = context.client;
|
|
395
|
+
if (!stitch2.isConnected) {
|
|
396
|
+
await stitch2.connect();
|
|
397
|
+
}
|
|
398
|
+
const rawClient = stitch2.client;
|
|
399
|
+
if (!rawClient) {
|
|
400
|
+
context.result = { success: false, error: "logging path requires a connected StitchToolClient" };
|
|
401
|
+
return { success: false };
|
|
402
|
+
}
|
|
403
|
+
const startedAt = new Date().toISOString();
|
|
404
|
+
const t0 = Date.now();
|
|
405
|
+
let raw = null;
|
|
406
|
+
let threw = null;
|
|
407
|
+
try {
|
|
408
|
+
raw = await rawClient.callTool({ name: tool, arguments: args }, CallToolResultSchema, { timeout: 600000 });
|
|
409
|
+
} catch (e) {
|
|
410
|
+
threw = e instanceof Error ? e : new Error(String(e));
|
|
411
|
+
}
|
|
412
|
+
const finishedAt = new Date().toISOString();
|
|
413
|
+
const durationMs = Date.now() - t0;
|
|
414
|
+
try {
|
|
415
|
+
await this.capture.capture({
|
|
416
|
+
tool,
|
|
417
|
+
args,
|
|
418
|
+
result: threw ? { isError: true, content: [{ type: "text", text: threw.message }] } : raw,
|
|
419
|
+
duration_ms: durationMs,
|
|
420
|
+
started_at: startedAt,
|
|
421
|
+
finished_at: finishedAt
|
|
422
|
+
});
|
|
423
|
+
} catch (e) {
|
|
424
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
425
|
+
console.error(`[stitch-mcp log] capture failed: ${msg}`);
|
|
426
|
+
}
|
|
427
|
+
if (threw) {
|
|
428
|
+
context.result = { success: false, error: threw.message };
|
|
429
|
+
return { success: false, error: threw };
|
|
430
|
+
}
|
|
431
|
+
context.result = parseToolResponse(raw);
|
|
432
|
+
return { success: true };
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
function parseToolResponse(raw) {
|
|
436
|
+
if (raw?.isError) {
|
|
437
|
+
const errorText = (raw.content ?? []).map((c) => c.type === "text" ? c.text : "").join("");
|
|
438
|
+
return { success: false, error: errorText };
|
|
439
|
+
}
|
|
440
|
+
if (raw?.structuredContent) {
|
|
441
|
+
return { success: true, data: raw.structuredContent };
|
|
442
|
+
}
|
|
443
|
+
const textContent = raw?.content?.find((c) => c.type === "text");
|
|
444
|
+
if (textContent?.text) {
|
|
445
|
+
try {
|
|
446
|
+
return { success: true, data: JSON.parse(textContent.text) };
|
|
447
|
+
} catch {
|
|
448
|
+
return { success: true, data: textContent.text };
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
return { success: true, data: raw };
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
// src/commands/tool/handler.ts
|
|
455
|
+
var deps = {
|
|
456
|
+
runSteps,
|
|
457
|
+
ListToolsStep,
|
|
458
|
+
ShowSchemaStep,
|
|
459
|
+
ParseArgsStep,
|
|
460
|
+
ValidateToolStep,
|
|
461
|
+
ExecuteToolStep
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
class ToolCommandHandler {
|
|
465
|
+
client;
|
|
466
|
+
stitchInstance;
|
|
467
|
+
tools;
|
|
468
|
+
steps;
|
|
469
|
+
constructor(client, tools, stitchInstance) {
|
|
470
|
+
this.client = client || new StitchToolClient;
|
|
471
|
+
this.stitchInstance = stitchInstance || stitch;
|
|
472
|
+
this.tools = tools || virtualTools;
|
|
473
|
+
const executeStep = isLogEnabled() ? new LogExecuteToolStep(createCaptureHandler()) : new deps.ExecuteToolStep;
|
|
474
|
+
this.steps = [
|
|
475
|
+
new deps.ListToolsStep,
|
|
476
|
+
new deps.ShowSchemaStep,
|
|
477
|
+
new deps.ParseArgsStep,
|
|
478
|
+
new deps.ValidateToolStep,
|
|
479
|
+
executeStep
|
|
480
|
+
];
|
|
481
|
+
}
|
|
482
|
+
async execute(input) {
|
|
483
|
+
const context = {
|
|
484
|
+
input,
|
|
485
|
+
client: this.client,
|
|
486
|
+
stitch: this.stitchInstance,
|
|
487
|
+
virtualTools: this.tools
|
|
488
|
+
};
|
|
489
|
+
try {
|
|
490
|
+
await deps.runSteps(this.steps, context, {
|
|
491
|
+
onAfterStep: (_step, _result, ctx) => ctx.result !== undefined
|
|
492
|
+
});
|
|
493
|
+
} finally {
|
|
494
|
+
await this.client.close();
|
|
495
|
+
}
|
|
496
|
+
return context.result ?? { success: false, error: "No step produced a result" };
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
export {
|
|
500
|
+
deps,
|
|
501
|
+
ToolCommandHandler
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
//# debugId=2553BE06DD1DE09064756E2164756E21
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/commands/tool/virtual-tools/get-screen-code.ts", "../src/commands/tool/virtual-tools/get-screen-image.ts", "../src/commands/tool/virtual-tools/build-site.ts", "../src/commands/tool/virtual-tools/list-tools.ts", "../src/commands/tool/virtual-tools/index.ts", "../src/commands/tool/steps/ListToolsStep.ts", "../src/commands/tool/steps/ShowSchemaStep.ts", "../src/commands/tool/steps/ParseArgsStep.ts", "../src/commands/tool/steps/ValidateToolStep.ts", "../src/commands/tool/steps/ExecuteToolStep.ts", "../src/commands/tool/steps/LogExecuteToolStep.ts", "../src/commands/tool/handler.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { StitchToolClient, Stitch } from '@google/stitch-sdk';\nimport { downloadText } from '../../../ui/copy-behaviors/clipboard.js';\nimport type { VirtualTool } from '../spec.js';\n\nexport const getScreenCodeTool: VirtualTool = {\n name: 'get_screen_code',\n description: '(Virtual) Retrieves a screen and downloads its HTML code content.',\n inputSchema: {\n type: 'object',\n properties: {\n projectId: {\n type: 'string',\n description: 'Required. The project ID of screen to retrieve.',\n },\n screenId: {\n type: 'string',\n description: 'Required. The name of screen to retrieve.',\n },\n },\n required: ['projectId', 'screenId'],\n },\n execute: async (client: StitchToolClient, args: any, stitch?: Stitch) => {\n if (!stitch) throw new Error('get_screen_code requires a Stitch instance');\n const { projectId, screenId } = args;\n\n // 1. Get the screen details using the injected SDK instance\n const screen = await stitch.project(projectId).getScreen(screenId);\n\n // 2. Fetch HTML Code\n let htmlContent: string | null = null;\n try {\n const htmlUrl = await screen.getHtml();\n if (htmlUrl) {\n htmlContent = await downloadText(htmlUrl);\n }\n } catch (e) {\n console.error(`Error downloading HTML code: ${e}`);\n }\n\n // 3. Return screen with code content\n return {\n screenId: screen.screenId,\n projectId: screen.projectId,\n htmlContent,\n };\n },\n};\n",
|
|
6
|
+
"import type { StitchToolClient, Stitch } from '@google/stitch-sdk';\nimport type { VirtualTool } from '../spec.js';\n\nexport const getScreenImageTool: VirtualTool = {\n name: 'get_screen_image',\n description: '(Virtual) Retrieves a screen and downloads its screenshot image content.',\n inputSchema: {\n type: 'object',\n properties: {\n projectId: {\n type: 'string',\n description: 'Required. The project ID of screen to retrieve.',\n },\n screenId: {\n type: 'string',\n description: 'Required. The name of screen to retrieve.',\n },\n },\n required: ['projectId', 'screenId'],\n },\n execute: async (client: StitchToolClient, args: any, stitch?: Stitch) => {\n if (!stitch) throw new Error('get_screen_image requires a Stitch instance');\n const { projectId, screenId } = args;\n\n // 1. Get the screen details using the injected SDK instance\n const screen = await stitch.project(projectId).getScreen(screenId);\n\n // 2. Fetch Image Content\n let imageContent: string | null = null;\n try {\n const imageUrl = await screen.getImage();\n if (imageUrl) {\n const response = await fetch(imageUrl);\n const arrayBuffer = await response.arrayBuffer();\n const buffer = Buffer.from(arrayBuffer);\n imageContent = buffer.toString('base64');\n }\n } catch (e) {\n console.error(`Error downloading screenshot: ${e}`);\n }\n\n // 3. Return screen with image content\n return {\n screenId: screen.screenId,\n projectId: screen.projectId,\n imageContent,\n };\n },\n};\n",
|
|
7
|
+
"import type { StitchToolClient, Stitch } from '@google/stitch-sdk';\nimport type { VirtualTool } from '../spec.js';\nimport pLimit from 'p-limit';\nimport { fetchWithRetry } from '../../site/utils/fetchWithRetry.js';\n\nexport const buildSiteTool: VirtualTool = {\n name: 'build_site',\n description: '(Virtual) Builds a site from a Stitch project by mapping screens to routes. Returns the design HTML for each page to use as context for code generation.',\n inputSchema: {\n type: 'object',\n properties: {\n projectId: {\n type: 'string',\n description: 'Required. The project ID to build a site from.',\n },\n routes: {\n type: 'array',\n description: 'Required. Array of screen-to-route mappings.',\n items: {\n type: 'object',\n properties: {\n screenId: {\n type: 'string',\n description: 'The screen ID to use for this route.',\n },\n route: {\n type: 'string',\n description: 'The route path (e.g. \"/\" or \"/about\").',\n },\n },\n required: ['screenId', 'route'],\n },\n },\n },\n required: ['projectId', 'routes'],\n },\n execute: async (client: StitchToolClient, args: any, stitch?: Stitch) => {\n if (!stitch) throw new Error('build_site requires a Stitch instance');\n const { projectId, routes } = args;\n\n // Validate routes\n if (!Array.isArray(routes)) {\n throw new Error('routes must be an array');\n }\n if (routes.length === 0) {\n throw new Error('routes must be a non-empty array');\n }\n for (const entry of routes) {\n if (!entry.screenId || typeof entry.screenId !== 'string') {\n throw new Error('Each route entry must have a \"screenId\" string');\n }\n if (!entry.route || typeof entry.route !== 'string') {\n throw new Error('Each route entry must have a \"route\" string');\n }\n }\n\n // Check for duplicate routes\n const routePaths = routes.map((r: any) => r.route);\n const uniqueRoutes = new Set(routePaths);\n if (uniqueRoutes.size !== routePaths.length) {\n const duplicates = routePaths.filter((r: string, i: number) => routePaths.indexOf(r) !== i);\n throw new Error(`Duplicate route paths found: ${[...new Set(duplicates)].join(', ')}`);\n }\n\n // Fetch project screens via injected SDK instance\n const project = stitch.project(projectId);\n const sdkScreens = await project.screens();\n const screenMap = new Map(sdkScreens.map((s: any) => [s.screenId, s]));\n\n // Validate all requested screenIds exist\n const missingIds = routes\n .map((r: any) => r.screenId)\n .filter((id: string) => !screenMap.has(id));\n if (missingIds.length > 0) {\n throw new Error(`Screen IDs not found in project: ${missingIds.join(', ')}`);\n }\n\n // Fetch HTML for each screen with concurrency limit\n const limit = pLimit(3);\n const htmlContent = new Map<string, string>();\n const errors: string[] = [];\n\n await Promise.all(\n routes.map((r: any) =>\n limit(async () => {\n const screen = screenMap.get(r.screenId)!;\n try {\n const htmlUrl = await screen.getHtml();\n if (htmlUrl) {\n const html = await fetchWithRetry(htmlUrl);\n htmlContent.set(r.screenId, html);\n } else {\n htmlContent.set(r.screenId, '');\n }\n } catch (e: any) {\n errors.push(`${r.screenId}: ${e.message}`);\n }\n })\n )\n );\n\n if (errors.length > 0) {\n throw new Error(`Failed to fetch HTML for screens: ${errors.join('; ')}`);\n }\n\n // Return raw HTML content for each page\n const pages = routes.map((r: any) => ({\n screenId: r.screenId,\n route: r.route,\n title: screenMap.get(r.screenId)!.title ?? r.screenId,\n html: htmlContent.get(r.screenId)!,\n }));\n\n return {\n success: true,\n pages,\n message: `Built ${pages.length} page(s) with design HTML`,\n };\n },\n};\n",
|
|
8
|
+
"import type { VirtualTool } from '../spec.js';\nimport type { StitchToolClient } from '@google/stitch-sdk';\n\nexport const listToolsTool: VirtualTool = {\n name: 'list_tools',\n description: 'List all available tools with their descriptions and schemas.',\n inputSchema: {\n type: 'object',\n properties: {},\n },\n execute: async (client: StitchToolClient, _args: any) => {\n const result = await client.listTools();\n return result.tools || [];\n },\n};\n",
|
|
9
|
+
"export type { VirtualTool } from '../spec.js';\nexport { getScreenCodeTool } from './get-screen-code.js';\nexport { getScreenImageTool } from './get-screen-image.js';\nexport { buildSiteTool } from './build-site.js';\nexport { listToolsTool } from './list-tools.js';\n\nimport { getScreenCodeTool } from './get-screen-code.js';\nimport { getScreenImageTool } from './get-screen-image.js';\nimport { buildSiteTool } from './build-site.js';\nimport { listToolsTool } from './list-tools.js';\nimport type { VirtualTool } from '../spec.js';\n\nexport const virtualTools: VirtualTool[] = [\n getScreenCodeTool,\n getScreenImageTool,\n buildSiteTool,\n listToolsTool,\n];\n",
|
|
10
|
+
"import type { CommandStep, StepResult } from '../../../framework/CommandStep.js';\nimport type { ToolContext } from '../context.js';\n\nexport class ListToolsStep implements CommandStep<ToolContext> {\n id = 'list-tools';\n name = 'List available tools';\n\n async shouldRun(context: ToolContext): Promise<boolean> {\n const name = context.input.toolName?.toLowerCase();\n return !name || name === 'list' || name === 'listtools' || name === 'list_tools';\n }\n\n async run(context: ToolContext): Promise<StepResult> {\n const result = await context.client.listTools();\n const serverTools = result.tools || [];\n const tools = [\n ...context.virtualTools.map(t => ({ name: t.name, description: t.description, inputSchema: t.inputSchema, virtual: true as const })),\n ...serverTools.map(t => ({ ...t, virtual: false as const })),\n ];\n context.result = { success: true, data: tools };\n return { success: true };\n }\n}\n",
|
|
11
|
+
"import type { CommandStep, StepResult } from '../../../framework/CommandStep.js';\nimport type { ToolContext } from '../context.js';\nimport type { ToolInfo } from '../spec.js';\n\nexport class ShowSchemaStep implements CommandStep<ToolContext> {\n id = 'show-schema';\n name = 'Show tool schema';\n\n async shouldRun(context: ToolContext): Promise<boolean> {\n return !!context.input.toolName && context.input.toolName !== 'list' && context.input.showSchema;\n }\n\n async run(context: ToolContext): Promise<StepResult> {\n const toolName = context.input.toolName!;\n\n // Get all tools to find the one we need\n const result = await context.client.listTools();\n const serverTools = result.tools || [];\n const allTools = [...context.virtualTools, ...serverTools];\n const tool = allTools.find(t => t.name === toolName);\n\n if (!tool) {\n context.result = { success: false, error: `Tool not found: ${toolName}` };\n return { success: false, error: new Error(`Tool not found: ${toolName}`) };\n }\n\n context.result = { success: true, data: this.formatSchema(tool) };\n return { success: true };\n }\n\n private formatSchema(tool: ToolInfo): object {\n const schema = tool.inputSchema;\n const args: Record<string, string> = {};\n\n if (schema?.properties) {\n for (const [key, prop] of Object.entries(schema.properties)) {\n const required = schema.required?.includes(key) ? '(required)' : '(optional)';\n args[key] = `${prop.type} ${required}${prop.description ? ' - ' + prop.description : ''}`;\n }\n }\n\n return {\n name: tool.name,\n description: tool.description,\n virtual: tool.virtual ?? false,\n arguments: args,\n example: this.generateExample(tool),\n };\n }\n\n private generateExample(tool: ToolInfo): string {\n const exampleArgs: Record<string, any> = {};\n if (tool.inputSchema?.properties) {\n for (const [key, prop] of Object.entries(tool.inputSchema.properties)) {\n exampleArgs[key] = prop.type === 'string' ? `<${key}>` : `<${prop.type}>`;\n }\n }\n return `stitch-mcp tool ${tool.name} -d '${JSON.stringify(exampleArgs)}'`;\n }\n}\n",
|
|
12
|
+
"import type { CommandStep, StepResult } from '../../../framework/CommandStep.js';\nimport type { ToolContext } from '../context.js';\n\nexport class ParseArgsStep implements CommandStep<ToolContext> {\n id = 'parse-args';\n name = 'Parse tool arguments';\n\n async shouldRun(context: ToolContext): Promise<boolean> {\n return !!context.input.toolName\n && context.input.toolName !== 'list'\n && !context.input.showSchema;\n }\n\n async run(context: ToolContext): Promise<StepResult> {\n let args: Record<string, any> = {};\n\n if (context.input.data) {\n args = JSON.parse(context.input.data);\n } else if (context.input.dataFile) {\n const content = await Bun.file(context.input.dataFile.replace('@', '')).text();\n args = JSON.parse(content);\n }\n\n context.parsedArgs = args;\n return { success: true };\n }\n}\n",
|
|
13
|
+
"import type { CommandStep, StepResult } from '../../../framework/CommandStep.js';\nimport type { ToolContext } from '../context.js';\n\nexport class ValidateToolStep implements CommandStep<ToolContext> {\n id = 'validate-tool';\n name = 'Validate tool exists';\n\n async shouldRun(context: ToolContext): Promise<boolean> {\n return !!context.input.toolName\n && context.input.toolName !== 'list'\n && !context.input.showSchema\n && context.parsedArgs !== undefined;\n }\n\n async run(context: ToolContext): Promise<StepResult> {\n const toolName = context.input.toolName!;\n\n const result = await context.client.listTools();\n const serverTools = result.tools || [];\n const allTools = [...context.virtualTools, ...serverTools];\n const found = allTools.find(t => t.name === toolName);\n\n if (!found) {\n const availableNames = allTools.map(t => t.name).sort();\n context.result = {\n success: false,\n error: `Tool not found: \"${toolName}\". Use \"list_tools\" to see available tools.`,\n data: {\n requestedTool: toolName,\n availableTools: availableNames,\n hint: 'Call \"list_tools\" to see all available tools with descriptions and schemas.',\n },\n };\n return { success: false, error: new Error(`Tool not found: ${toolName}`) };\n }\n\n return { success: true };\n }\n}\n",
|
|
14
|
+
"import type { CommandStep, StepResult } from '../../../framework/CommandStep.js';\nimport type { ToolContext } from '../context.js';\n\nexport class ExecuteToolStep implements CommandStep<ToolContext> {\n id = 'execute-tool';\n name = 'Execute tool';\n\n async shouldRun(context: ToolContext): Promise<boolean> {\n return context.parsedArgs !== undefined;\n }\n\n async run(context: ToolContext): Promise<StepResult> {\n const toolName = context.input.toolName!;\n const args = context.parsedArgs!;\n\n // Check if it's a virtual tool\n const virtualTool = context.virtualTools.find(t => t.name === toolName);\n if (virtualTool) {\n try {\n const result = await virtualTool.execute(context.client, args, context.stitch);\n context.result = { success: true, data: result };\n return { success: true };\n } catch (e: any) {\n context.result = { success: false, error: `Virtual tool execution failed: ${e.message || String(e)}` };\n return { success: false, error: e };\n }\n }\n\n const result = await context.client.callTool(toolName, args);\n context.result = { success: true, data: result };\n return { success: true };\n }\n}\n",
|
|
15
|
+
"import { CallToolResultSchema } from '@modelcontextprotocol/sdk/types.js';\nimport type { CommandStep, StepResult } from '../../../framework/CommandStep.js';\nimport type { CaptureSpec } from '../../../lib/log/capture/spec.js';\nimport type { ToolContext } from '../context.js';\n\n/**\n * Execute step variant that captures the raw MCP envelope before parsing.\n * Used in place of {@link ExecuteToolStep} when STITCH_MCP_LOG=1.\n *\n * Reaches through the {@link StitchToolClient} into its underlying MCP `Client`\n * so the raw {@link CallToolResult} is observable (the public callTool() throws\n * on isError, losing the envelope).\n */\nexport class LogExecuteToolStep implements CommandStep<ToolContext> {\n id = 'execute-tool';\n name = 'Execute tool (with capture)';\n\n constructor(private readonly capture: CaptureSpec) {}\n\n async shouldRun(context: ToolContext): Promise<boolean> {\n return context.parsedArgs !== undefined;\n }\n\n async run(context: ToolContext): Promise<StepResult> {\n const tool = context.input.toolName!;\n const args = context.parsedArgs!;\n\n // Virtual tools have no MCP envelope to capture; behave exactly as ExecuteToolStep.\n const virtualTool = context.virtualTools.find((t) => t.name === tool);\n if (virtualTool) {\n try {\n const result = await virtualTool.execute(context.client, args, context.stitch);\n context.result = { success: true, data: result };\n return { success: true };\n } catch (e: any) {\n context.result = { success: false, error: `Virtual tool execution failed: ${e.message || String(e)}` };\n return { success: false, error: e };\n }\n }\n\n // Ensure connected via the public surface (StitchToolClient handles auth + transport).\n const stitch = context.client as any;\n if (!stitch.isConnected) {\n await stitch.connect();\n }\n const rawClient = stitch.client; // the underlying MCP SDK Client\n if (!rawClient) {\n context.result = { success: false, error: 'logging path requires a connected StitchToolClient' };\n return { success: false };\n }\n\n const startedAt = new Date().toISOString();\n const t0 = Date.now();\n let raw: any = null;\n let threw: Error | null = null;\n try {\n // Stitch generations can take minutes; the MCP SDK default (60s) is too short.\n raw = await rawClient.callTool({ name: tool, arguments: args }, CallToolResultSchema, { timeout: 600_000 });\n } catch (e: any) {\n threw = e instanceof Error ? e : new Error(String(e));\n }\n const finishedAt = new Date().toISOString();\n const durationMs = Date.now() - t0;\n\n // Always capture — including transport-level throws — so we don't lose the attempt.\n try {\n await this.capture.capture({\n tool, args,\n result: threw\n ? { isError: true, content: [{ type: 'text', text: threw.message }] }\n : raw,\n duration_ms: durationMs,\n started_at: startedAt, finished_at: finishedAt,\n });\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n // eslint-disable-next-line no-console\n console.error(`[stitch-mcp log] capture failed: ${msg}`);\n }\n\n if (threw) {\n context.result = { success: false, error: threw.message };\n return { success: false, error: threw };\n }\n context.result = parseToolResponse(raw);\n return { success: true };\n }\n}\n\n/** Mirrors {@link StitchToolClient}'s parseToolResponse for context.result shape. */\nfunction parseToolResponse(raw: any): { success: boolean; data?: any; error?: string } {\n if (raw?.isError) {\n const errorText = (raw.content ?? [])\n .map((c: any) => (c.type === 'text' ? c.text : ''))\n .join('');\n return { success: false, error: errorText };\n }\n if (raw?.structuredContent) {\n return { success: true, data: raw.structuredContent };\n }\n const textContent = raw?.content?.find((c: any) => c.type === 'text');\n if (textContent?.text) {\n try { return { success: true, data: JSON.parse(textContent.text) }; }\n catch { return { success: true, data: textContent.text }; }\n }\n return { success: true, data: raw };\n}\n",
|
|
16
|
+
"import { StitchToolClient, stitch as defaultStitch } from '@google/stitch-sdk';\nimport type { Stitch } from '@google/stitch-sdk';\nimport type { CommandStep } from '../../framework/CommandStep.js';\nimport { runSteps } from '../../framework/StepRunner.js';\nimport type { ToolCommandInput, ToolCommandResult, VirtualTool } from './spec.js';\n\nimport type { ToolContext } from './context.js';\nimport { virtualTools as defaultVirtualTools } from './virtual-tools/index.js';\nimport { ListToolsStep } from './steps/ListToolsStep.js';\nimport { ShowSchemaStep } from './steps/ShowSchemaStep.js';\nimport { ParseArgsStep } from './steps/ParseArgsStep.js';\nimport { ValidateToolStep } from './steps/ValidateToolStep.js';\nimport { ExecuteToolStep } from './steps/ExecuteToolStep.js';\nimport { LogExecuteToolStep } from './steps/LogExecuteToolStep.js';\nimport { createCaptureHandler, isLogEnabled } from '../../lib/log/factory.js';\n\nexport const deps = {\n runSteps,\n ListToolsStep,\n ShowSchemaStep,\n ParseArgsStep,\n ValidateToolStep,\n ExecuteToolStep,\n};\n\nexport class ToolCommandHandler {\n private client: StitchToolClient;\n private stitchInstance: Stitch;\n private tools: VirtualTool[];\n private steps: CommandStep<ToolContext>[];\n\n constructor(client?: StitchToolClient, tools?: VirtualTool[], stitchInstance?: Stitch) {\n this.client = client || new StitchToolClient();\n this.stitchInstance = stitchInstance || defaultStitch;\n this.tools = tools || defaultVirtualTools;\n const executeStep: CommandStep<ToolContext> = isLogEnabled()\n ? new LogExecuteToolStep(createCaptureHandler())\n : new deps.ExecuteToolStep();\n this.steps = [\n new deps.ListToolsStep(),\n new deps.ShowSchemaStep(),\n new deps.ParseArgsStep(),\n new deps.ValidateToolStep(),\n executeStep,\n ];\n }\n\n async execute(input: ToolCommandInput): Promise<ToolCommandResult> {\n const context: ToolContext = {\n input,\n client: this.client,\n stitch: this.stitchInstance,\n virtualTools: this.tools,\n };\n\n try {\n await deps.runSteps(this.steps, context, {\n onAfterStep: (_step, _result, ctx) => ctx.result !== undefined,\n });\n } finally {\n await this.client.close();\n }\n\n return context.result ?? { success: false, error: 'No step produced a result' };\n }\n}\n"
|
|
17
|
+
],
|
|
18
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,IAAM,oBAAiC;AAAA,EAC5C,MAAM;AAAA,EACN,aAAa;AAAA,EACb,aAAa;AAAA,IACX,MAAM;AAAA,IACN,YAAY;AAAA,MACV,WAAW;AAAA,QACT,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA,UAAU;AAAA,QACR,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,IACF;AAAA,IACA,UAAU,CAAC,aAAa,UAAU;AAAA,EACpC;AAAA,EACA,SAAS,OAAO,QAA0B,MAAW,YAAoB;AAAA,IACvE,IAAI,CAAC;AAAA,MAAQ,MAAM,IAAI,MA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