81trust / 100

Dev Url Parser

by AgentTools in Documents & files

x402 APIPassing, checked 4 h ago

Parse a URL into all its components: protocol, hostname, port, path segments, query parameters (as a clean object), hash and credentials. Exact — no guessing by eye. Use this when an agent needs to break any URL into protocol, host, path and params.

GET https://agenttools-hub.vercel.app/api/v1/dev/url-parser

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
100%
Response time
151 ms typical, 151 ms slowest 5%
Last check
4 h ago
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X GET "https://agenttools-hub.vercel.app/api/v1/dev/url-parser?url=https%3A%2F%2Fuser%3Apw%40api.example.com%3A8443%2Fv1%2Fusers%3Fpage%3D2%26sort%3Dname%26tag%3Da%26tag%3Db%23results"
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fagenttools-hub.vercel.app%2Fapi%2Fv1%2Fdev%2Furl-parser
const res = await pay("https://agenttools-hub.vercel.app/api/v1/dev/url-parser?url=https%3A%2F%2Fuser%3Apw%40api.example.com%3A8443%2Fv1%2Fusers%3Fpage%3D2%26sort%3Dname%26tag%3Da%26tag%3Db%23results");
console.log(await res.json());

Example input

{
  "url": "https://user:[email protected]:8443/v1/users?page=2&sort=name&tag=a&tag=b#results"
}

Example output

{
  "result": {
    "answer": "https://api.example.com:8443/v1/users?page=2&sort=name&tag=a&tag=b#results",
    "answerLabel": "Normalized URL",
    "artifacts": {
      "params": "{\"page\":\"2\",\"sort\":\"name\",\"tag\":[\"a\",\"b\"]}",
      "segments": "[\"v1\",\"users\"]"
    },
    "details": [
      {
        "label": "Protocol",
        "value": "https"
      },
      {
        "label": "Host",
        "value": "api.example.com"
      },
      {
        "label": "Port",
        "value": "8443"
      },
      {
        "label": "Credentials",
        "value": "user:•••"
      },
      {
        "label": "Path",
        "value": "/v1/users"
      },
      {
        "label": "Path segments",
        "value": "v1 › users"
      },
      {
        "label": "Query string",
        "value": "?page=2&sort=name&tag=a&tag=b"
      },
      {
        "label": "Hash",
        "value": "#results"
      },
      {
        "label": "Origin",
        "value": "https://api.example.com:8443"
      }
    ],
    "steps": [
      "new URL(input)",
      "Extract components + parse query pairs (repeated keys become arrays)"
    ],
    "table": {
      "columns": [
        "Query parameter",
        "Value(s)"
      ],
      "rows": [
        [
          "page",
          "2"
        ],
        [
          "sort",
          "name"
        ],
        [
          "tag",
          "a, b"
        ]
      ]
    },
    "value": null
  },
  "tool": "url-parser"
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
4 h agoPassed402151 ms$0.002