Skip to content

Commit b002f81

Browse files
committed
made it simple by removing Zodunion
1 parent d900005 commit b002f81

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 (~6885 cl100k_base tokens)
3+
# Chrome DevTools MCP Tool Reference (~6750 cl100k_base tokens)
44

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

196196
**Parameters:**
197197

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

201201
---

scripts/generate-docs.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ interface ZodDef {
7474
checks?: ZodCheck[];
7575
values?: string[];
7676
type?: ZodSchema;
77-
options?: ZodSchema[];
7877
innerType?: ZodSchema;
7978
schema?: ZodSchema;
8079
defaultValue?: () => unknown;
@@ -295,22 +294,6 @@ function getZodTypeInfo(schema: ZodSchema): TypeInfo {
295294
result.items = getZodTypeInfo(def.type);
296295
}
297296
break;
298-
case 'ZodUnion':
299-
if (def.options?.length) {
300-
result.type = def.options
301-
.map(option => {
302-
const optionInfo = getZodTypeInfo(option);
303-
if (optionInfo.type === 'array') {
304-
const itemType = optionInfo.items?.type ?? 'unknown';
305-
return `array of ${itemType}`;
306-
}
307-
return optionInfo.type;
308-
})
309-
.join(' | ');
310-
} else {
311-
result.type = 'unknown';
312-
}
313-
break;
314297
default:
315298
result.type = 'unknown';
316299
}

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)