Text Analysis

Mask Text

Mask Text selectively hides characters in strings while preserving specified start and end portions — essential for logging sensitive data or displaying partial credentials. Access via MCP in Cursor/Claude or REST at `/v1/text/mask`. For example, mask "secretpassword123" keeping 2 start + 2 end chars to show "se**********23". Deterministic masking ensures consistent output across calls.

API Endpoint

GET /v1/text/mask

Code Examples

curl "https://tinyfn.io/v1/text/mask" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/text/mask', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/text/mask',
    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 text analysis tools:

{
  "mcpServers": {
    "tinyfn-text": {
      "url": "https://tinyfn.io/mcp/text",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How do I mask a string keeping only the first 3 and last 2 characters visible?

Call the endpoint with your text and specify start=3, end=2 parameters. The middle portion gets replaced with asterisks or your chosen mask character.

What happens when masking text shorter than the visible character count?

If the text length is less than start + end characters, the entire string remains visible without masking to prevent data loss.

Can I use MCP to mask sensitive data in AI agent workflows?

Yes, Claude Code and other MCP clients can call this tool to safely log or display partial sensitive information like API keys, passwords, or personal data.

What character is used for masking and can I customize it?

By default uses asterisks (*) for masking. Check the API documentation for customization options like different mask characters or patterns.

Does text masking work with Unicode and special characters?

Yes, the tool handles Unicode strings correctly, counting characters (not bytes) when determining start/end positions and applying masks.

Try Mask Text Now

Get your free API key and start using Mask Text in seconds.

Get Free API Key