Text Tools
Text manipulation and analysis utilities for AI agents.
Provider: Built-in
Authentication: None required
Category: Utilities
Credit Cost: 0 credits (free)
Overview
Text tools provide fast, local text processing operations without external API calls. Use these for string manipulation, text analysis, and data extraction in your AI workflows.
Available Tools
Count Words
Count words, characters, and other text statistics.
Tool ID: text_Count_Words
Credit Cost: 0 credits (free)
Parameters:
text(string, required): Text to analyze
Response:
{
"word_count": 42,
"character_count": 256,
"text_length": 256
}
Example Usage:
# Python
response = client.call_tool(
name="text_Count_Words",
arguments={
"text": "Hello world from MCP! This is a test."
}
)
# Returns: {"word_count": 8, "character_count": 40, "text_length": 40}
// TypeScript
const response = await client.callTool({
name: "text_Count_Words",
arguments: {
text: "The quick brown fox jumps over the lazy dog"
}
});
// Returns: {"word_count": 9}
Use Cases:
- Validate content length requirements
- Track document statistics
- Check character limits for social media posts
- Analyze text complexity
Extract Emails
Find and extract email addresses from text.
Tool ID: text_Extract_Emails
Credit Cost: 0 credits (free)
Parameters:
text(string, required): Text containing email addresses
Response:
{
"emails": ["user@example.com", "contact@company.org"],
"count": 2
}
Example Usage:
# Python
text = """
Contact us at support@company.com for help.
Sales inquiries: sales@company.com
"""
response = client.call_tool(
name="text_Extract_Emails",
arguments={"text": text}
)
# Returns: {"emails": ["support@company.com", "sales@company.com"], "count": 2}
// TypeScript
const response = await client.callTool({
name: "text_Extract_Emails",
arguments: {
text: "Reach out to john.doe@example.com or jane@company.org"
}
});
// Returns: {"emails": ["john.doe@example.com", "jane@company.org"]}
Use Cases:
- Extract contacts from documents
- Parse email signatures
- Find email addresses in scraped content
- Build contact lists from text
Limitations:
- May not catch all edge cases of valid emails
- Does not validate if email addresses actually exist
- Returns duplicates if same email appears multiple times
Reverse Text
Reverse the order of characters in a string.
Tool ID: text_Reverse_Text
Credit Cost: 0 credits (free)
Parameters:
text(string, required): Text to reverse
Response:
{
"original": "Hello World",
"reversed": "dlroW olleH"
}
Example Usage:
# Python
response = client.call_tool(
name="text_Reverse_Text",
arguments={"text": "MCP Protocol"}
)
# Returns: {"reversed": "locotorP PCM"}
// TypeScript
const response = await client.callTool({
name: "text_Reverse_Text",
arguments: {
text: "12345"
}
});
// Returns: {"reversed": "54321"}
Use Cases:
- Test string manipulation functions
- Create simple encoding/obfuscation
- Reverse usernames or codes
- Palindrome detection workflows
To Uppercase
Convert text to uppercase letters.
Tool ID: text_To_Uppercase
Credit Cost: 0 credits (free)
Parameters:
text(string, required): Text to convert
Response:
{
"original": "hello world",
"uppercase": "HELLO WORLD"
}
Example Usage:
# Python
response = client.call_tool(
name="text_To_Uppercase",
arguments={"text": "make this loud"}
)
# Returns: {"uppercase": "MAKE THIS LOUD"}
// TypeScript
const response = await client.callTool({
name: "text_To_Uppercase",
arguments: {
text: "Reeva MCP Server"
}
});
// Returns: {"uppercase": "REEVA MCP SERVER"}
Use Cases:
- Normalize text for comparison
- Format headers and titles
- Create consistent database keys
- Standard formatting for constants
Common Patterns
Email Extraction Pipeline
# Scrape webpage and extract emails
webpage_content = scrape_tool.call(url="https://example.com")
emails = client.call_tool(
name="text_Extract_Emails",
arguments={"text": webpage_content}
)
# Store in database
for email in emails["emails"]:
database.insert(email)
Content Validation
# Check if social media post is within character limit
post_text = "This is my tweet about AI and MCP!"
stats = client.call_tool(
name="text_Count_Words",
arguments={"text": post_text}
)
if stats["character_count"] <= 280:
print("✓ Post is within Twitter character limit")
else:
print("✗ Post exceeds limit")
Text Normalization
# Normalize company names for database lookup
company_input = "Apple Inc."
normalized = client.call_tool(
name="text_To_Uppercase",
arguments={"text": company_input}
)
# Lookup: "APPLE INC."
result = database.find(normalized["uppercase"])
Contact Aggregation
# Extract emails from multiple sources
sources = [
webpage_content,
email_body,
document_text
]
all_emails = []
for source in sources:
result = client.call_tool(
name="text_Extract_Emails",
arguments={"text": source}
)
all_emails.extend(result["emails"])
# Remove duplicates
unique_emails = list(set(all_emails))
Best Practices
Performance
- Text tools are extremely fast (< 1ms typically)
- Safe to use in loops and high-frequency operations
- No rate limiting or API costs
- Process large text without external dependencies
Data Validation
- Always validate input length for very large texts
- Be aware of Unicode and special characters
- Consider trimming whitespace before processing
Security
- Don't send sensitive data through tools unnecessarily
- Email extraction doesn't validate or verify addresses
- Uppercase conversion doesn't sanitize input
Troubleshooting
Empty Results from Extract Emails
Cause: No valid email format found in text
Solutions:
- Check text actually contains email addresses
- Verify email format is standard (user@domain.com)
- Look for typos or unusual formatting
Character Count Mismatch
Cause: Unicode characters or special characters
Solutions:
- Be aware of multi-byte characters
- Normalize text encoding if needed
- Check for hidden characters or whitespace
Unexpected Uppercase Results
Cause: Non-ASCII characters or emojis
Solutions:
- Verify input encoding
- Some characters don't have uppercase equivalents
- Emojis remain unchanged
Integration Examples
Example 1: Email Scraping Workflow
# Complete workflow: scrape website → extract emails → save to CRM
# Step 1: Scrape contact page
content = firecrawl.call(
name="firecrawl_Web_Scrape",
arguments={"url": "https://company.com/contact"}
)
# Step 2: Extract emails
emails = text.call(
name="text_Extract_Emails",
arguments={"text": content["markdown"]}
)
# Step 3: Save to Supabase
for email in emails["emails"]:
supabase.call(
name="supabase_create_records",
arguments={
"table": "contacts",
"records": [{"email": email, "source": "website"}]
}
)
Example 2: Content Moderation
# Check content before posting
post = "Check out this amazing new product!"
# Get statistics
stats = text.call(
name="text_Count_Words",
arguments={"text": post}
)
# Validation rules
if stats["word_count"] < 5:
print("❌ Post too short")
elif stats["character_count"] > 280:
print("❌ Post too long for Twitter")
else:
print("✅ Post looks good!")
Example 3: Data Normalization
# Normalize product codes for database consistency
product_code = "abc-123-xyz"
normalized = text.call(
name="text_To_Uppercase",
arguments={"text": product_code}
)
# Store as: "ABC-123-XYZ"
inventory.update(code=normalized["uppercase"])
Advanced Use Cases
Multi-Tool Text Processing
# Complex text analysis combining multiple tools
def analyze_text(content):
# Get basic stats
stats = text.call(
name="text_Count_Words",
arguments={"text": content}
)
# Extract emails
emails = text.call(
name="text_Extract_Emails",
arguments={"text": content}
)
# Normalize for comparison
normalized = text.call(
name="text_To_Uppercase",
arguments={"text": content}
)
return {
"stats": stats,
"contacts": emails["emails"],
"normalized": normalized["uppercase"]
}
Batch Processing
# Process multiple documents efficiently
documents = [doc1, doc2, doc3, ...]
results = []
for doc in documents:
result = text.call(
name="text_Count_Words",
arguments={"text": doc}
)
results.append({
"doc_id": doc.id,
"word_count": result["word_count"]
})
# Analyze results
avg_words = sum(r["word_count"] for r in results) / len(results)
Related Tools
- Math Tools - Numerical operations and calculations
- Time Tools - Date and time formatting
- Web Scraper - Extract text content from websites
- Firecrawl - Advanced web scraping for text extraction
See Also
- Creating Custom Tools - Pre-configure text operations
- Tool Testing - Test text operations in playground
- All Tools - Browse complete tool catalog