Skip to content

Commit 9b3020c

Browse files
committed
made it simple by removing Zodunion
1 parent 1bb8f13 commit 9b3020c

5 files changed

Lines changed: 6 additions & 29 deletions

File tree

docs/tool-reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- AUTO GENERATED DO NOT EDIT - run 'npm run docs' to update-->
22

3-
# Chrome DevTools MCP Tool Reference (~6769 cl100k_base tokens)
3+
# Chrome DevTools MCP Tool Reference (~6750 cl100k_base tokens)
44

55
- **[Input automation](#input-automation)** (8 tools)
66
- [`click`](#click)
@@ -194,7 +194,7 @@
194194

195195
**Parameters:**
196196

197-
- **text** (unknown) **(required)**: Non-empty list of texts. Resolves when any value appears on the page.
197+
- **text** (array) **(required)**: Non-empty list of texts. Resolves when any value appears on the page.
198198
- **timeout** (integer) _(optional)_: Maximum wait time in milliseconds. If set to 0, the default timeout will be used.
199199

200200
---

scripts/generate-docs.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ interface ZodDef {
7272
checks?: ZodCheck[];
7373
values?: string[];
7474
type?: ZodSchema;
75-
options?: ZodSchema[];
7675
innerType?: ZodSchema;
7776
schema?: ZodSchema;
7877
defaultValue?: () => unknown;
@@ -293,22 +292,6 @@ function getZodTypeInfo(schema: ZodSchema): TypeInfo {
293292
result.items = getZodTypeInfo(def.type);
294293
}
295294
break;
296-
case 'ZodUnion':
297-
if (def.options?.length) {
298-
result.type = def.options
299-
.map(option => {
300-
const optionInfo = getZodTypeInfo(option);
301-
if (optionInfo.type === 'array') {
302-
const itemType = optionInfo.items?.type ?? 'unknown';
303-
return `array of ${itemType}`;
304-
}
305-
return optionInfo.type;
306-
})
307-
.join(' | ');
308-
} else {
309-
result.type = 'unknown';
310-
}
311-
break;
312295
default:
313296
result.type = 'unknown';
314297
}

src/McpContext.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -881,10 +881,7 @@ export class McpContext implements Context {
881881
return this.#networkCollector.getIdForResource(request);
882882
}
883883

884-
waitForTextOnPage(
885-
text: [string, ...string[]],
886-
timeout?: number,
887-
): Promise<Element> {
884+
waitForTextOnPage(text: string[], timeout?: number): Promise<Element> {
888885
const page = this.getSelectedPage();
889886
const frames = page.frames();
890887

src/tools/ToolDefinition.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,7 @@ export type Context = Readonly<{
144144
action: () => Promise<unknown>,
145145
options?: {timeout?: number},
146146
): Promise<void>;
147-
waitForTextOnPage(
148-
text: [string, ...string[]],
149-
timeout?: number,
150-
): Promise<Element>;
147+
waitForTextOnPage(text: string[], timeout?: number): Promise<Element>;
151148
getDevToolsData(): Promise<DevToolsData>;
152149
/**
153150
* Returns a reqid for a cdpRequestId.

src/tools/snapshot.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export const waitFor = defineTool({
5050
},
5151
schema: {
5252
text: zod
53-
.tuple([zod.string()])
54-
.rest(zod.string())
53+
.array(zod.string())
54+
.min(1)
5555
.describe(
5656
'Non-empty list of texts. Resolves when any value appears on the page.',
5757
),

0 commit comments

Comments
 (0)