String Utilities

Extract Numbers

Extracts all numeric values from any text string, returning them as an array. Use via MCP in Cursor or Windsurf for parsing invoices, logs, or user input, or call GET /v1/string/extract-numbers directly. Finds integers, decimals, and negative numbers while ignoring text. Perfect for AI agents processing mixed content where reliable number extraction beats regex guesswork.

API Endpoint

GET /v1/string/extract-numbers

Code Examples

curl "https://tinyfn.io/v1/string/extract-numbers" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/string/extract-numbers', {
  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/extract-numbers',
    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 extract numbers from text using MCP in Cursor?

Call the extract_numbers tool with your text string. It returns an array of all numeric values found, preserving decimals and negatives.

What number formats does extract-numbers recognize?

Detects integers (42), decimals (3.14), negative numbers (-15), and scientific notation (1e6). Ignores currency symbols and separators.

Does extract-numbers preserve the original number format?

Returns numbers as parsed numeric values, not strings. So '3.14' becomes 3.14, and '042' becomes 42.

Can I extract numbers from structured data like JSON or CSV?

Yes, it processes any text input. Useful for parsing logs, configuration files, or mixed content where numbers are embedded in text.

What happens if no numbers are found in the text?

Returns an empty array. The function never fails - it always returns a valid array structure.

Try Extract Numbers Now

Get your free API key and start using Extract Numbers in seconds.

Get Free API Key