Test regex patterns against strings. Get all matches, capture groups, positions, and plain-English pattern explanations.
Single tool 'text_test_regex' has a well-structured input schema with proper types and descriptions for all three parameters (pattern, flags, testStrings). The tool description is comprehensive (380+ chars) and includes explicit guidance on when to use it and what NOT to use it for, which is excellent for LLM disambiguation. Output schema is documented in the description with field-level detail (pattern, flags, explanation, results array structure, totalMatches). However, the description is somewhat verbose and could be tightened to 150-200 chars for optimal LLM token efficiency. Parameter descriptions are clear and actionable. No critical gaps, but minor optimization opportunities exist.
Use this when you need to test a regular expression against one or more strings. Returns all matches, capture groups, positions, and a human-readable explanation of the pattern. 1. pattern -- the regex pattern tested 2. flags -- flags applied (g, i, m, s, u) 3. explanation -- plain-English description of what the pattern matches 4. results -- array of test results per string, each with: matched (boolean), matches (array with value, index, groups) 5. totalMatches -- total match count across all test strings Example output: {"pattern":"\\d{3}-\\d{4}","flags":"g","explanation":"Matches 3 digits, a hyphen, then 4 digits","results":[{"input":"Call 555-1234","matched":true,"matches":[{"value":"555-1234","index":5,"groups":[]}]}],"totalMatches":1} Use this FOR validating regex patterns before deploying them in code, debugging why a pattern fails to match, or extracting structured data from text. Use this BEFORE writing complex regex into production code. Do NOT use for text classification -- use text_classify_content instead. Do NOT use for PII detection -- use privacy_detect_pii instead. Do NOT use for text comparison -- use text_compare_diff instead.
Tool description is verbose (380+ chars), exceeds optimal 150-200 char range for LLM token efficiency. Includes good guidance but could be condensed.
No error handling guidance in tool description. Does not explain what happens if regex is invalid, if testStrings is empty, or how to recover from malformed patterns.
Output schema documented only in description text, not as a formal JSON Schema object. LLMs cannot parse unstructured schema descriptions reliably.
No explicit constraints on 'flags' parameter, description says 'g, i, m, s, u' but does not state whether combinations are allowed, order matters, or invalid flags are rejected.
Inferred effective spec: 2025-06-18+.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | C | 68 | 2025-06-18+ | v2 |