String Utilities

Contains

Checks whether a text string contains a specified substring, returning a boolean result. Use via MCP in Cursor or Windsurf for reliable string matching, or call GET /v1/string/contains with text and substring parameters. Example: checking if "hello world" contains "world" returns true. Case-sensitive by default, ensuring deterministic results across AI workflows.

API Endpoint

GET /v1/string/contains

Code Examples

curl "https://tinyfn.io/v1/string/contains" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/string/contains', {
  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/contains',
    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 check if text contains a substring using MCP?

Call the contains tool with your text and substring parameters. It returns a boolean true/false result for exact matches.

Is substring matching case-sensitive?

Yes, matching is case-sensitive by default. 'Hello' and 'hello' are treated as different strings.

Can I use contains for partial email or URL validation?

Yes, you can check if text contains '@' for basic email detection or 'http' for URLs, but use dedicated validation tools for robust checking.

What's the difference between contains and search functions?

Contains returns true/false for exact substring matches, while search functions typically return positions or extract matching patterns.

How does MCP contains compare to programming language built-ins?

Provides the same functionality as Python's 'in' operator or JavaScript's includes(), but with consistent behavior across AI agents and guaranteed deterministic results.

Try Contains Now

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

Get Free API Key