String MCP Tools for AI Agents

"How many R's in strawberry?" This question became a meme because LLMs consistently get it wrong. String counting, pattern extraction, and text manipulation seem trivial — but LLMs process tokens, not characters. These tools give your agent precise string operations.

All String Tools (33)

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

ToolDescription
string/reverseReverse String
string/uppercaseUppercase
string/lowercaseLowercase
string/capitalizeCapitalize
string/title-caseTitle Case
string/sentence-caseSentence Case
string/camel-caseCamel Case
string/snake-caseSnake Case
string/kebab-caseKebab Case
string/pascal-casePascal Case
string/lengthString Length
string/word-countWord Count
string/trimTrim
string/truncateTruncate
string/padPad
string/repeatRepeat
string/replaceReplace
string/containsContains
string/starts-withStarts With
string/ends-withEnds With
string/splitSplit
string/joinJoin
string/slugSlug
string/is-palindromeIs Palindrome
string/count-charCount Char
string/count-substringCount Substring
string/count-all-charsCount All Chars
string/remove-whitespaceRemove Whitespace
string/normalize-whitespaceNormalize Whitespace
string/is-emptyIs Empty
string/extract-numbersExtract Numbers
string/extract-emailsExtract Emails
string/extract-urlsExtract Urls

Agent Scenarios

Here's how real agents use these tools:

1. Content moderation agent

A moderation agent needs to check if user input exceeds character limits. string/length returns the exact count, not an LLM guess.

Tool Call: string/length
{ "text": "Check this message length" }

2. SEO optimization agent

An SEO agent truncates meta descriptions to 160 characters without breaking words. string/truncate handles this cleanly.

Tool Call: string/truncate
{ "text": "Your long description...", "length": 160 }

3. Data cleaning pipeline

An ETL agent needs to pad order IDs to 8 characters with leading zeros. string/pad produces consistent results.

Tool Call: string/pad-start
{ "text": "1234", "length": 8, "char": "0" }

MCP Setup

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

Claude Desktop / Claude Code

Add this to your MCP config:

{
  "mcpServers": {
    "tinyfn-string": {
      "url": "https://api.tinyfn.io/mcp/string/",
      "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/string/sse
  • Headers: X-API-Key: your-api-key

Tip: Use the category-specific endpoint (/mcp/string/) 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 string 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 string tools to your agent?

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

Frequently Asked Questions

Why can't LLMs count characters accurately?

LLMs process text as tokens (chunks of characters), not individual characters. When asked to count specific characters, they must reason about tokenized representations, which leads to frequent errors — especially with repeated characters.

What string operations does TinyFn provide?

TinyFn offers 30+ string tools: length, reverse, truncate, pad, repeat, count characters, extract substrings, split, join, replace, and more.

Can these tools handle Unicode text?

Yes. All TinyFn string tools handle Unicode correctly, including emoji, CJK characters, and multi-byte sequences.

Ready to try TinyFn?

Get your free API key and start building in minutes.

Get Free API Key