Skip to content

feat: support any-match text arrays in wait_for#1011

Merged
OrKoN merged 7 commits intoChromeDevTools:mainfrom
ashutoshpw:fix/wait-for-any-match-916
Feb 24, 2026
Merged

feat: support any-match text arrays in wait_for#1011
OrKoN merged 7 commits intoChromeDevTools:mainfrom
ashutoshpw:fix/wait-for-any-match-916

Conversation

@ashutoshpw
Copy link
Contributor

@ashutoshpw ashutoshpw commented Feb 21, 2026

Summary

Enhances wait_for to support waiting on multiple possible texts and resolve when any one appears.

This addresses long-running flows that can end in different UI outcomes (for example, "Complete" or "Error"), avoiding unnecessary 300s waits when only one expected string is provided.

Closes #916.

Tool Update

wait_for

Waits for text on the selected page, now with any-match support.

Parameter Type Required Description
text string | string[] yes A single text or a non-empty list of texts. Resolves when any value appears.
timeout integer no Maximum wait in ms (0 keeps default behavior).

Design / Implementation

  • Kept backward compatibility: existing single-string text calls continue to work unchanged.
  • Added schema support for string | string[] with non-empty array validation.
  • Updated context API to accept string | string[].
  • Matching logic now normalizes to an array and races all candidates across all frames using both:
    • aria/
    • text/
  • Added clearer response output for array input:
    • Element matching one of ["Complete","Error"] found.
  • Updated generated tool docs for the new wait_for contract.
  • Improved docs generation to render ZodUnion types (so union params are documented correctly, not as unknown).

Tests

Added/updated coverage for:

  • Schema acceptance of:
    • single string
    • non-empty string array
    • rejection of empty array
  • Any-match array success case
  • Any-match array when matching text appears later (async/delayed content)
  • Existing wait_for behavior remains covered for single-text usage

Executed relevant test suites:

  • tests/tools/snapshot.test.ts
  • tests/McpContext.test.ts
  • tests/index.test.ts

Confirmation after the change applied:
https://opncd.ai/share/8m6I4r4a

@ashutoshpw ashutoshpw changed the title fix: support any-match text arrays in wait_for feat: support any-match text arrays in wait_for Feb 21, 2026
@ashutoshpw ashutoshpw marked this pull request as ready for review February 21, 2026 13:04
@OrKoN
Copy link
Collaborator

OrKoN commented Feb 23, 2026

Thanks for the PR! Mostly looks good, left a couple of comments.

@ashutoshpw ashutoshpw requested a review from OrKoN February 23, 2026 08:29
@ashutoshpw ashutoshpw force-pushed the fix/wait-for-any-match-916 branch from 862130e to 1bb8f13 Compare February 23, 2026 12:49
Copy link
Collaborator

@Lightning00Blade Lightning00Blade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good with some comments.

Copy link
Collaborator

@Lightning00Blade Lightning00Blade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Could you rebase as there seem to be some merge conflicts.
I will wait for @OrKoN review as well before merging.

Copy link
Collaborator

@OrKoN OrKoN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, please resolve merge conflict

Implements wait_for text as string | string[] and resolves when any candidate appears.

Adds schema/tests/docs updates for ChromeDevTools#916.
Updated the description of the wait_for tool to remove unnecessary details about input types. Removed tests that validated string and array inputs for the wait_for schema, as they are no longer applicable.
@ashutoshpw ashutoshpw force-pushed the fix/wait-for-any-match-916 branch from 9b3020c to 3c38d21 Compare February 23, 2026 19:25
@ashutoshpw
Copy link
Contributor Author

@OrKoN Conflicts resolved (rebased with upstream main and regenerated docs)

@OrKoN OrKoN enabled auto-merge February 24, 2026 07:11
@OrKoN OrKoN added this pull request to the merge queue Feb 24, 2026
Merged via the queue into ChromeDevTools:main with commit 496ab1b Feb 24, 2026
17 checks passed
github-merge-queue bot pushed a commit that referenced this pull request Feb 25, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.18.0](chrome-devtools-mcp-v0.17.3...chrome-devtools-mcp-v0.18.0)
(2026-02-24)


### 🎉 Features

* `--slim` mode for maximum token savings
([#958](#958))
([c402b43](c402b43))
* add a new skill for accessibility debugging and auditing with Chrome
DevTools MCP.
([#1002](#1002))
([b0c6d04](b0c6d04))
* add experimental screencast recording tools
([#941](#941))
([33446d4](33446d4))
* add skill to debug and optimize LCP
([#993](#993))
([2cd9b95](2cd9b95))
* add storage-isolated browser contexts
([#991](#991))
([59f6477](59f6477))
* add take_memory_snapshot tool
([#1023](#1023))
([7ffdc5e](7ffdc5e))
* support any-match text arrays in wait_for
([#1011](#1011))
([496ab1b](496ab1b))
* support type_text
([#1026](#1026))
([b5d01b5](b5d01b5))


### 🛠️ Fixes

* detect X server display on Linux
([#1027](#1027))
([1746ed9](1746ed9))


### ♻️ Chores

* cleanup string and structured console formatters
([#1005](#1005))
([0d78685](0d78685))
* extract version in a seprate file
([#1032](#1032))
([0106865](0106865))
* move emulation settings to context
([#1000](#1000))
([bc3c40e](bc3c40e))
* optimize slim tool descriptions and params
([#1028](#1028))
([ca6635d](ca6635d))
* simplify JavaScript code examples, update code block language, and
refine descriptions in a11y debugging skill documentation.
([#1009](#1009))
([5cedcaa](5cedcaa))
* types for JSON output of IssueFormatter
([#1007](#1007))
([9ef4479](9ef4479))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
wolfib pushed a commit to wolfib/chrome-devtools-mcp that referenced this pull request Mar 10, 2026
## Summary

Enhances wait_for to support waiting on multiple possible texts and
resolve when any one appears.

This addresses long-running flows that can end in different UI outcomes
(for example, "Complete" or "Error"), avoiding unnecessary 300s waits
when only one expected string is provided.

Closes ChromeDevTools#916.

## Tool Update

### wait_for

Waits for text on the selected page, now with any-match support.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| text | string \| string[] | yes | A single text or a non-empty list of
texts. Resolves when any value appears. |
| timeout | integer | no | Maximum wait in ms (0 keeps default
behavior). |

---

## Design / Implementation

- Kept backward compatibility: existing single-string text calls
continue to work unchanged.
- Added schema support for string | string[] with non-empty array
validation.
- Updated context API to accept string | string[].
- Matching logic now normalizes to an array and races all candidates
across all frames using both:
    - aria/<text>
    - text/<text>
- Added clearer response output for array input:
    - Element matching one of ["Complete","Error"] found.
- Updated generated tool docs for the new wait_for contract.
- Improved docs generation to render ZodUnion types (so union params are
documented correctly, not as unknown).
  
---

## Tests

Added/updated coverage for:

- Schema acceptance of:
    - single string
    - non-empty string array
    - rejection of empty array
- Any-match array success case
- Any-match array when matching text appears later (async/delayed
content)
- Existing wait_for behavior remains covered for single-text usage

Executed relevant test suites:

- tests/tools/snapshot.test.ts
- tests/McpContext.test.ts
- tests/index.test.ts 

Confirmation after the change applied:
https://opncd.ai/share/8m6I4r4a
wolfib pushed a commit to wolfib/chrome-devtools-mcp that referenced this pull request Mar 10, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.18.0](ChromeDevTools/chrome-devtools-mcp@chrome-devtools-mcp-v0.17.3...chrome-devtools-mcp-v0.18.0)
(2026-02-24)


### 🎉 Features

* `--slim` mode for maximum token savings
([ChromeDevTools#958](ChromeDevTools#958))
([c402b43](ChromeDevTools@c402b43))
* add a new skill for accessibility debugging and auditing with Chrome
DevTools MCP.
([ChromeDevTools#1002](ChromeDevTools#1002))
([b0c6d04](ChromeDevTools@b0c6d04))
* add experimental screencast recording tools
([ChromeDevTools#941](ChromeDevTools#941))
([33446d4](ChromeDevTools@33446d4))
* add skill to debug and optimize LCP
([ChromeDevTools#993](ChromeDevTools#993))
([2cd9b95](ChromeDevTools@2cd9b95))
* add storage-isolated browser contexts
([ChromeDevTools#991](ChromeDevTools#991))
([59f6477](ChromeDevTools@59f6477))
* add take_memory_snapshot tool
([ChromeDevTools#1023](ChromeDevTools#1023))
([7ffdc5e](ChromeDevTools@7ffdc5e))
* support any-match text arrays in wait_for
([ChromeDevTools#1011](ChromeDevTools#1011))
([496ab1b](ChromeDevTools@496ab1b))
* support type_text
([ChromeDevTools#1026](ChromeDevTools#1026))
([b5d01b5](ChromeDevTools@b5d01b5))


### 🛠️ Fixes

* detect X server display on Linux
([ChromeDevTools#1027](ChromeDevTools#1027))
([1746ed9](ChromeDevTools@1746ed9))


### ♻️ Chores

* cleanup string and structured console formatters
([ChromeDevTools#1005](ChromeDevTools#1005))
([0d78685](ChromeDevTools@0d78685))
* extract version in a seprate file
([ChromeDevTools#1032](ChromeDevTools#1032))
([0106865](ChromeDevTools@0106865))
* move emulation settings to context
([ChromeDevTools#1000](ChromeDevTools#1000))
([bc3c40e](ChromeDevTools@bc3c40e))
* optimize slim tool descriptions and params
([ChromeDevTools#1028](ChromeDevTools#1028))
([ca6635d](ChromeDevTools@ca6635d))
* simplify JavaScript code examples, update code block language, and
refine descriptions in a11y debugging skill documentation.
([ChromeDevTools#1009](ChromeDevTools#1009))
([5cedcaa](ChromeDevTools@5cedcaa))
* types for JSON output of IssueFormatter
([ChromeDevTools#1007](ChromeDevTools#1007))
([9ef4479](ChromeDevTools@9ef4479))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wait_for: ability to wait for multiple optional texts (any of them might match)

3 participants