Regex MCP Tools for AI Agents

Your agent tries to extract all email addresses from a document by "thinking about" the regex pattern. Sometimes it works, sometimes it misses edge cases or returns false positives. These tools execute real regex patterns against actual text.

All Regex Tools (19)

Your agent gets access to 19 regex tools via the /mcp/regex/ endpoint. Here's the complete list:

ToolDescription
regex/testTest Pattern
regex/find-allFind All Matches
regex/replaceRegex Replace
regex/splitRegex Split
regex/validateValidate Pattern
regex/escapeEscape Pattern
regex/groupsExtract Groups
regex/pattern/emailGet Email Pattern
regex/pattern/urlGet Url Pattern
regex/pattern/phoneGet Phone Pattern
regex/pattern/ipv4Get Ipv4 Pattern
regex/pattern/ipv6Get Ipv6 Pattern
regex/pattern/dateGet Date Pattern
regex/pattern/timeGet Time Pattern
regex/pattern/credit-cardGet Credit Card Pattern
regex/pattern/uuidGet Uuid Pattern
regex/pattern/slugGet Slug Pattern
regex/pattern/hex-colorGet Hex Color Pattern
regex/pattern/passwordGet Password Pattern

Agent Scenarios

Here's how real agents use these tools:

1. Data extraction agent

A scraping agent extracts all email addresses from a text block using a regex pattern.

Tool Call: regex/match
{ "text": "Contact us at info@example.com or support@example.com", "pattern": "[\\w.-]+@[\\w.-]+\\.\\w+" }

2. Log analysis agent

A monitoring agent extracts timestamps and error codes from log entries using regex patterns.

Tool Call: regex/extract
{ "text": "2026-02-15 ERROR [500] Connection failed", "pattern": "\\[(\\d+)\\]" }

3. Content cleanup agent

An editor agent replaces all phone number formats with a standardized format.

Tool Call: regex/replace
{ "text": "Call 555-1234 or (555) 567-8900", "pattern": "\\(?\\d{3}\\)?[-.\\s]?\\d{3}[-.\\s]?\\d{4}", "replacement": "[PHONE]" }

MCP Setup

Add regex tools to your agent in under 2 minutes. Choose your client:

Claude Desktop / Claude Code

Add this to your MCP config:

{
  "mcpServers": {
    "tinyfn-regex": {
      "url": "https://api.tinyfn.io/mcp/regex/",
      "headers": {
        "X-API-Key": "your-api-key"
      }
    }
  }
}

Cursor

Go to Settings > MCP and add a new server:

  • Type: SSE
  • URL: https://api.tinyfn.io/mcp/regex/sse
  • Headers: X-API-Key: your-api-key

Tip: Use the category-specific endpoint (/mcp/regex/) for the best experience. The all-in-one endpoint (/mcp/all/) works too but has 500+ tools which some clients handle less efficiently.

When to Use These Tools

Use regex MCP tools when your agent needs to:

  • Guarantee correctness — when wrong answers have real consequences
  • Process user data — when you're operating on actual user input, not hypothetical examples
  • Maintain consistency — when the same input must always produce the same output

You don't need these tools for casual conversation or rough estimates. Use them when precision matters.

Ready to add regex tools to your agent?

Get Free API Key 100 requests/month free. No credit card required.

Frequently Asked Questions

Can LLMs write regex patterns?

LLMs can often write correct regex patterns, but they can't execute them. The value of these tools is in the execution — actually running the pattern against text and returning real matches, not predicted ones.

What regex operations does TinyFn support?

TinyFn supports pattern matching (full match and find all), capturing group extraction, replacement, splitting by pattern, and pattern validation.

What regex flavor does TinyFn use?

TinyFn uses Python's re module, which supports a rich regex syntax including lookahead, lookbehind, named groups, and Unicode character classes.

Ready to try TinyFn?

Get your free API key and start building in minutes.

Get Free API Key