update_listing
Update an existing capability listing by changing its price, endpoint, or maximum latency. Requires a wallet.
Instructions
Alias of publish_listing — same idempotent upsert. Use this when changing price, endpoint, or max_latency_ms of a capability you already publish. Requires a wallet.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| capability | Yes | ||
| price_usdc | Yes | ||
| endpoint | Yes | ||
| max_latency_ms | Yes | ||
| first_call_free | No | ||
| currency | No | ||
| chain | No | Settlement chain for this listing. Only 'base' (Base mainnet) is accepted by the public registry. |
Implementation Reference
- packages/mcp-server/src/server.ts:174-196 (registration)Tool definition and input schema for update_listing — registered as an alias of publish_listing in the tools array.
{ name: "update_listing", description: "Alias of `publish_listing` — same idempotent upsert. Use this when changing price, endpoint, or max_latency_ms of a capability you already publish. Requires a wallet.", inputSchema: { type: "object", properties: { capability: { type: "string" }, price_usdc: { type: "string" }, endpoint: { type: "string" }, max_latency_ms: { type: "number" }, first_call_free: { type: "boolean" }, currency: { type: "string", enum: ["USDC"] }, chain: { type: "string", enum: ["base"], description: "Settlement chain for this listing. Only 'base' (Base mainnet) is accepted by the public registry.", }, }, required: ["capability", "price_usdc", "endpoint", "max_latency_ms"], }, }, - Handler for update_listing — delegates to client.publishListing() with the same logic as publish_listing.
case "publish_listing": case "update_listing": { if (!client) return walletRequired(name); const listing = await client.publishListing({ capability: String(args.capability), price_usdc: String(args.price_usdc), endpoint: String(args.endpoint), max_latency_ms: Number(args.max_latency_ms), first_call_free: Boolean(args.first_call_free ?? false), currency: (args.currency as "USDC" | undefined) ?? "USDC", chain: (args.chain as Listing["chain"] | undefined) ?? "base", } as Omit<Listing, "agent_id" | "signature">); return ok({ listing }); } - SDK client method publishListing — signs the listing payload with the wallet and POSTs it to the registry.
async publishListing( listing: Omit<Listing, "agent_id" | "signature">, ): Promise<Listing> { const partial = { ...listing, agent_id: this.agentId }; const signature = await this.wallet.signTypedPayload(partial); const signed: Listing = { ...partial, signature }; await this.transport.json("/v1/listings", { method: "POST", body: JSON.stringify(signed), }); return signed; } - packages/sdk-ts/src/types.ts:30-42 (schema)Zod schema and TypeScript type for the Listing object used by publishListing/update_listing.
export const ListingSchema = z.object({ agent_id: z.string().regex(/^0x[a-fA-F0-9]{40}$/) as z.ZodType<AgentId>, capability: z.string(), price_usdc: z.string().regex(/^\d+(\.\d+)?$/), currency: z.literal("USDC").default("USDC"), chain: z.literal("base").default("base"), max_latency_ms: z.number().int().positive(), first_call_free: z.boolean().default(false), endpoint: z.string().url(), signature: z.string().regex(/^0x[a-fA-F0-9]+$/) as z.ZodType<Hex>, }); export type Listing = z.infer<typeof ListingSchema>;