Aerostack
search

web-url-build Edge Function — Web Search

Web Search

Build a URL from a base and optional path, query parameters, and hash fragment.

navin @navin verified
Updated Mar 12, 2026
GitHub

Edge function web-url-build Build a URL from a base and optional path, query parameters, and hash fragment.. Deployed on Cloudflare Workers — zero cold starts, globally distributed. Mount it via your Aerostack workspace to call it from any AI agent.

terminal — aerostack cli
$ npx aerostack add navin/web-url-build
smart_toy

Use with AI Assistants

MCP

Connect 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.

claude_desktop_config.json
{
  "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
call_function({
  slug: "web-url-build",
  args: {
    "base": "example_base",
    "options": null
  }
})

web-url-build — Build a URL from parts

Programmatically construct URLs from a base, path, query parameters (with array support), and hash fragment.


API

POST /api/web-url-build

Request body

Field Type Required Default Description
base string Yes Base URL
options.path string No Path to append
options.query object No Query params; arrays become repeated keys
options.hash string No Hash fragment (with or without #)
options.trailingSlash boolean No false Append trailing slash

Success response (200)

{
  "success": true,
  "data": {
    "url": "https://example.com/search?q=hello&tag=a&tag=b#results",
    "queryString": "?q=hello&tag=a&tag=b"
  }
}

Error responses

Code HTTP When
INVALID_INPUT 400 Missing or invalid base
INTERNAL_ERROR 500 Invalid URL or unexpected error

Usage

cURL
curl -X POST "$FUNCTION_URL" \
  -H "Content-Type: application/json" \
  -d '{"base": "https://example.com", "options": {"path": "/search", "query": {"q": "hello", "tag": ["a","b"]}}}'
Direct import
import { webUrlBuild } from '@aerostack/functions/web-url-build';

const result = webUrlBuild({
  base: 'https://api.example.com',
  options: { path: '/v1/users', query: { page: 2, limit: 25 } },
});
console.log(result.url); // https://api.example.com/v1/users?page=2&limit=25

Use Cases

  • Constructing paginated API URLs dynamically in server-side code
  • Building share links with UTM tracking parameters
  • Generating signed or parameterized webhook callback URLs

Metadata

upgrade Version 1.0.0
gavel License MIT
language Language typescript
cloud Provider aerostack

Tags

web
deployed_code

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 →

Frequently asked questions

What does the web-url-build function do? +

web-url-build 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-build function? +

Install the Aerostack CLI and run: ```bash aerostack deploy function @navin/web-url-build ``` It will be live on Cloudflare Workers in seconds.

What runtime does web-url-build use? +

web-url-build runs on aerostack on the Cloudflare Workers edge runtime — zero cold starts, globally distributed.

Can I customise the web-url-build function? +

Yes. Fork the function from your Aerostack dashboard, modify the source, and redeploy. All changes are version-controlled.