web-url-parse Edge Function — Web Search
Web SearchParse a URL into structured parts including protocol, host, pathname, query object, and hash.
Edge function web-url-parse Parse a URL into structured parts including protocol, host, pathname, query object, and hash.. Deployed on Cloudflare Workers — zero cold starts, globally distributed. Mount it via your Aerostack workspace to call it from any AI agent.
npx aerostack add navin/web-url-parse Use with AI Assistants
MCPConnect Claude, Cursor, or any MCP-compatible client — then call this function by slug
① Add MCP Server
Add this once — access all Aerostack functions from your AI tool.
{
"mcpServers": {
"aerostack": {
"url": "https://mcp.aerostack.dev",
"type": "http"
}
}
} ② Call this function
Ask your AI to use the call_function tool with this slug:
call_function({
slug: "web-url-parse",
args: {
"url": "example_url"
}
}) web-url-parse — Parse a URL into structured parts
Decompose any URL into protocol, host, pathname, query params, hash, and more. Supports repeated query keys as arrays.
API
POST /api/web-url-parse
Request body
| Field | Type | Required | Description |
|---|---|---|---|
url |
string | Yes | The URL string to parse |
Success response (200)
{
"success": true,
"data": {
"protocol": "https",
"host": "example.com",
"hostname": "example.com",
"port": null,
"pathname": "/path",
"search": "?foo=bar",
"hash": "#section",
"origin": "https://example.com",
"query": { "foo": "bar" },
"valid": true
}
}
Error responses
| Code | HTTP | When |
|---|---|---|
INVALID_INPUT |
400 | Missing url field |
INTERNAL_ERROR |
500 | Unexpected error |
Usage
cURL
curl -X POST "$FUNCTION_URL" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/path?tag=a&tag=b#section"}'
TypeScript / JavaScript
const response = await fetch(FUNCTION_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ url: 'https://example.com/path?foo=bar' }),
});
const { data } = await response.json();
console.log(data.query); // { foo: 'bar' }
Direct import
import { webUrlParse } from '@aerostack/functions/web-url-parse';
const result = webUrlParse({ url: 'https://example.com?tag=a&tag=b' });
console.log(result.query); // { tag: ['a', 'b'] }
Use Cases
- Extracting UTM parameters from marketing URLs for analytics
- Validating and normalizing incoming redirect URLs
- Building URL-aware routing logic in edge middleware
Metadata
Tags
Publisher
@navin verified
Build and publish your own functions
Write a TypeScript function, deploy it to the edge, and share it with thousands of developers — in minutes.
More Web Search Functions
Browse Web Search Functions →web-query-stringify
by @navin
Serialize a parameters object to a URL query string with support for arrays, encoding, and null skipping.
web-content-type-parse
by @navin
Parse a Content-Type header value into MIME type, subtype, charset, boundary, and convenience boolean flags.
web-headers-parse
by @navin
Parse a raw HTTP header block string or object into a structured lowercase-keyed object with content-type and authorization extraction.
web-ip-extract
by @navin
Extract the real client IP address from HTTP request headers, with proxy trust control and private IP detection.
web-query-parse
by @navin
Parse a URL query string into a typed object with support for arrays, number/boolean coercion, and bracket notation.
web-url-build
by @navin
Build a URL from a base and optional path, query parameters, and hash fragment.
Frequently asked questions
What does the web-url-parse function do? +
web-url-parse is a serverless edge function for web-search automation written in aerostack. Deploy it to Cloudflare Workers via your Aerostack workspace.
How do I deploy the web-url-parse function? +
Install the Aerostack CLI and run: ```bash aerostack deploy function @navin/web-url-parse ``` It will be live on Cloudflare Workers in seconds.
What runtime does web-url-parse use? +
web-url-parse runs on aerostack on the Cloudflare Workers edge runtime — zero cold starts, globally distributed.
Can I customise the web-url-parse function? +
Yes. Fork the function from your Aerostack dashboard, modify the source, and redeploy. All changes are version-controlled.