Counts words in any text string with precise, deterministic results. Use via MCP in Cursor or Windsurf, or call GET /v1/string/word-count directly. Returns exact word count using standard whitespace delimiters — "hello world" gives 2, empty string gives 0. Perfect for content analysis and validation in AI workflows.
curl "https://tinyfn.io/v1/string/word-count" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/string/word-count', {
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/word-count',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
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"
}
}
}
}
TinyFn uses standard whitespace delimiters (spaces, tabs, newlines) to split text into words. It's deterministic and consistent, unlike some tools that handle punctuation differently.
Yes, the MCP tool in Cursor, Claude Code, and other editors can process large text blocks. There's no practical limit for typical document analysis tasks.
Words with attached punctuation count as single words. "Hello, world!" counts as 2 words, not 4. Standalone punctuation marks are ignored.
Yes, it works with any UTF-8 text including non-Latin scripts. However, it uses space-based splitting which works best for space-separated languages.
Use it via MCP for real-time counting in your IDE, or call the REST API programmatically. Great for content validation, text processing pipelines, and document analysis.