URL/Slug Utilities

Join Path

Combines multiple path segments into a single, properly formatted path with correct separators. Use via MCP in Cursor or Claude Code, or hit GET /v1/slug/join-path with path parts as parameters. Handles edge cases like trailing slashes, empty segments, and mixed separators. Returns clean, normalized paths for URLs, file systems, or routing.

API Endpoint

GET /v1/slug/join-path

Code Examples

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

response = requests.get('https://tinyfn.io/v1/slug/join-path',
    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 url/slug tools:

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

Learn more about MCP setup →

FAQ

How do I join multiple path segments safely without double slashes?

Pass each segment as a separate parameter to join-path. It automatically normalizes separators and removes empty segments, preventing issues like '/api//users/' becoming '/api/users/'.

Can MCP agents use join-path for dynamic URL construction?

Yes, AI agents can call join-path through MCP to build URLs programmatically. Especially useful when constructing API endpoints or file paths from variable components without manual string concatenation.

Does join-path handle both forward slashes and backslashes?

Yes, it normalizes mixed separators to forward slashes and handles both Windows-style backslashes and Unix-style forward slashes consistently.

What happens with empty or null path segments?

Empty segments are automatically filtered out, so joining ['api', '', 'users', null] produces '/api/users' instead of '/api//users/'.

Should I use join-path instead of manual string concatenation?

Yes, manual concatenation often creates bugs with double slashes or missing separators. Join-path handles edge cases deterministically that manual string building misses.

Try Join Path Now

Get your free API key and start using Join Path in seconds.

Get Free API Key