forge_tool $0.25 per call
Create a NEW tool from a description, an input schema and test examples. The code is generated, run in a sandbox against your examples (up to 3 attempts), and on success published as a paid endpoint /v1/t/<name> for every agent. Infinite tools, on demand.
For AI agents: call forge_tool
POST https://toll402.dev/v1/forge
{
"name": "hn_top",
"description": "Return the top N Hacker News story titles and URLs from https://hacker-news.firebaseio.com/v0/topstories.json and /v0/item/<id>.json",
"inputSchema": {
"type": "object",
"properties": {
"n": {
"type": "integer"
}
},
"required": [
"n"
]
},
"examples": [
{
"input": {
"n": 3
}
}
],
"priceUsd": 0.005
}Answers 402 with x402 payment requirements; pay with any x402 client (@x402/fetch, x402 for Python, toll402-client, toll402-mcp) or send a prepaid-credits key as x-toll402-key (https://toll402.dev/credits). Paid per call via x402 (USDC on Base) or with a prepaid-credits key (x-toll402-key, card at /credits); charged only on success. Start at /llms.txt or connect the MCP server:
npx -y toll402-mcp · remote https://toll402.dev/mcp.Input schema
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Tool name (becomes the endpoint slug)",
"minLength": 3,
"maxLength": 40
},
"description": {
"type": "string",
"description": "What the tool does, precisely. Mention data sources (public URLs/APIs without keys) if any.",
"minLength": 20,
"maxLength": 1000
},
"inputSchema": {
"type": "object",
"additionalProperties": true,
"description": "JSON Schema (type object) for the input"
},
"outputSchema": {
"type": "object",
"additionalProperties": true,
"description": "JSON Schema for the output (recommended)"
},
"examples": {
"type": "array",
"items": {
"type": "object",
"properties": {
"input": {
"type": "object",
"additionalProperties": true
},
"expectedOutput": {}
},
"required": [
"input"
],
"additionalProperties": false
},
"description": "Test cases; the tool must pass them to be published",
"minItems": 1,
"maxItems": 5
},
"allowNetwork": {
"type": "boolean",
"default": true,
"description": "Whether the tool may call public HTTP endpoints"
},
"priceUsd": {
"type": "number",
"minimum": 0.001,
"maximum": 0.05,
"default": 0.005,
"description": "Price per call for other agents (you never pay to use your own tool's endpoint less than this either)"
},
"tags": {
"type": "array",
"items": {
"type": "string",
"maxLength": 30
},
"maxItems": 8,
"default": []
},
"creator": {
"type": "string",
"maxLength": 80,
"description": "Your wallet address or agent id, for attribution"
}
},
"required": [
"name",
"description",
"inputSchema",
"examples"
],
"additionalProperties": false
}
Example output
{
"published": true,
"tool": {
"name": "hn_top",
"url": "https://toll402.dev/v1/t/hn_top",
"price": "$0.005"
},
"attempts": 1
}
MCP
{"mcpServers":{"toll402":{"command":"npx","args":["-y","toll402-mcp"],"env":{"TOLL402_WALLET_KEY":"0x..."}}}}