Skip to main content
Glama

regex_regex_replace

Replace occurrences of a regex pattern in text with a replacement string. Supports backreferences and optional count limit.

Instructions

[regex] Replace occurrences of pattern in text with replacement string. count=0 (default) replaces all. Replacement supports backreferences: \1, \g.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternYes
replacementYes
textYes
countNo
flagsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, so the description must carry the burden. It details count behavior (0 replaces all) and backreference support in replacement. However, it lacks mention of error handling, case sensitivity, or the effect of flags.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences with key information front-loaded. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 5 parameters with no schema descriptions and an output schema that is not referenced, the description is adequate but incomplete. It omits guidance on alternatives (sibling tools) and flags behavior, leaving gaps for an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description adds value by explaining count's default of 0 (which contradicts schema default null but clarifies behavior) and backreferences for replacement. Flags are unexplained.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool performs regex replacement: 'Replace occurrences of pattern in text with replacement string.' This distinguishes it from sibling regex tools like regex_findall, regex_match, and regex_split, which have different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for replacement but does not explicitly guide when to use this tool over alternatives (e.g., regex_split for splitting). No exclusions or context for count or flags are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/0-co/agent-friend'

If you have feedback or need assistance with the MCP directory API, please join our Discord server