String Utilities

Replace

Performs text find-and-replace operations with exact string matching. Access via MCP in Cursor or Windsurf, or GET /v1/string/replace endpoint. Replace "old_text" with "new_text" in any input string — useful for cleaning data, transforming templates, or batch text processing in AI workflows.

API Endpoint

GET /v1/string/replace

Code Examples

curl "https://tinyfn.io/v1/string/replace" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/string/replace', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/string/replace',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's string tools:

{
  "mcpServers": {
    "tinyfn-string": {
      "url": "https://tinyfn.io/mcp/string",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How do I replace multiple different strings in one operation?

Make separate API calls for each replacement. The replace function handles one find-and-replace pair per request, but you can chain operations or use it iteratively in MCP workflows.

Does string replace support regex patterns or wildcards?

No, it performs exact string matching only. To replace 'cat' it won't match 'cats' — you need the exact substring.

What happens if the search string doesn't exist in the text?

Returns the original text unchanged. No error is thrown — it's a safe operation that won't break your AI agent workflows.

Can I replace all occurrences or just the first one?

Replaces all occurrences by default. If 'hello' appears 3 times in your text, all 3 instances get replaced with your new string.

How do I use string replace in my MCP-enabled AI coding assistant?

Call the replace tool with your source text, search string, and replacement. Useful for refactoring code snippets, cleaning CSV data, or transforming configuration templates.

Try Replace Now

Get your free API key and start using Replace in seconds.

Get Free API Key