Skip to content

A2A Agent Card fetch

$0.005 per callUSDC via x402POST /api/a2a-card-fetch

Discover and fetch a site's A2A (Agent2Agent protocol) Agent Card - tries /.well-known/agent-card.json then /.well-known/agent.json (or fetches a direct .json URL as-is) - and validate it against the spec v0.3 structural core.

Category: Network & domainsTags: a2a agent2agent agent-card well-known discovery interop agents

Try in playground →

Details

Returns the card, errors, interop warnings, and a normalized summary. Mini-A2A discovery for agents. Marked untrustedContent: the fetched card is external, untrusted data.

Parameters

NameTypeRequiredDescription
urlstringyessite root, domain, or a direct agent-card .json URL Also accepted as link, uri, href, page.

Example request

curl -i -X POST https://agent402.tools/api/a2a-card-fetch \
  -H "Content-Type: application/json" \
  -d '{"url":"https://agent402.tools/samples/a2a-agent-card.json"}'

Watch a call get paid

RequestPOST /api/a2a-card-fetch
402$0.005 USDC
SignPAYMENT-SIGNATURE
Settleon 14 chains
Answer200 OK
ReceiptAgent402-ReceiptEd25519

Example response

{
  "source": "https://agent402.tools/samples/a2a-agent-card.json",
  "valid": true,
  "errors": [],
  "summary": {
    "name": "Sample Weather Agent",
    "skillCount": 1
  }
}
FieldTypeAlways presentIn the example
sourcestringyeshttps://agent402.tools/samples/a2a-agent-card.json
validbooleanyestrue
errorsarrayyes0 items in the example
summaryobjectyes2 fields: name, skillCount

From an MCP client

catalog.call {
  "slug": "a2a-card-fetch",
  "params": {
    "url": "https://agent402.tools/samples/a2a-agent-card.json"
  }
}

Hosted connector (https://agent402.tools/mcp): paid in the call. Stdio package (npx -y agent402-mcp@0.18.0): pays from a wallet or AGENT402_CREDITS_KEY.

Errors and behavior

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.005" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.AGENT_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/a2a-card-fetch", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "url": "https://agent402.tools/samples/a2a-agent-card.json"
  }),
});

Get a wallet or run npx -y agent402-mcp@0.18.0 wallet new.

The quote (Python)

import base64, json, urllib.error, urllib.request

req = urllib.request.Request("https://agent402.tools/api/a2a-card-fetch", method="POST", data="{\"url\":\"https://agent402.tools/samples/a2a-agent-card.json\"}".encode(), headers={"Content-Type": "application/json"})
try:
    urllib.request.urlopen(req)
except urllib.error.HTTPError as e:
    quote = json.loads(base64.b64decode(e.headers["PAYMENT-REQUIRED"]))
    print(e.code, [(a["network"], a["amount"]) for a in quote["accepts"]])  # the price, per chain, in base units

Related tools