Removes leading and trailing whitespace from text strings through GET /v1/string/trim. Essential for cleaning user input, parsing data, or preparing text for processing. Works with spaces, tabs, newlines, and other Unicode whitespace. MCP integration lets Claude and Cursor handle text cleanup deterministically without guesswork.
curl "https://tinyfn.io/v1/string/trim" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/string/trim', {
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/trim',
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"
}
}
}
}
Send a GET request to /v1/string/trim with your text as a parameter. The API returns the string with all leading and trailing whitespace removed.
It removes all Unicode whitespace characters including spaces, tabs, newlines, carriage returns, and other whitespace defined by the Unicode standard.
Yes, the trim tool is available in Cursor, Claude Code, GitHub Copilot, Windsurf, Cline, OpenClaw, and Zed via MCP for reliable text cleaning without AI hallucination.
Correct, it only removes leading and trailing whitespace. Internal whitespace within the string remains unchanged.
The function returns the original string unchanged. It's safe to use on any text without checking for whitespace first.