bootstrap
Establish agent identity by binding a client ID to your API key before making payments. Use this tool to generate a server-assigned ID or specify your preferred identifier for secure transaction handling.
Instructions
Bind a client_id to the current API Key, or let the server generate one. This is the recommended way to establish agent identity before making payment calls. Once bound, the client_id cannot be changed for this API Key. Behavior: • API Key not yet bound + no preferred_client_id → server generates a ca_ prefixed ID. • API Key not yet bound + preferred_client_id → binds the provided value. • API Key already bound + same value (or omitted) → idempotent, returns existing binding. • API Key already bound + different value → 409 conflict. On success, the returned client_id is automatically saved locally. Example: bootstrap() → { client_id: 'ca_abc123', created: true } Example: bootstrap({ preferred_client_id: 'my-agent-uuid' }) → { client_id: 'my-agent-uuid', created: true }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| preferred_client_id | No | Optional: your preferred client_id value. If omitted, server generates one with ca_ prefix. |
Implementation Reference
- src/tools/auth.ts:70-110 (handler)Implementation of the "bootstrap" tool, which binds a client_id to the API key, either using a provided preferred_client_id or by letting the server generate one. It also handles the local saving of the bound client ID.
server.tool( "bootstrap", [ "Bind a client_id to the current API Key, or let the server generate one.", "This is the recommended way to establish agent identity before making payment calls.", "Once bound, the client_id cannot be changed for this API Key.", "", "Behavior:", "• API Key not yet bound + no preferred_client_id → server generates a ca_ prefixed ID.", "• API Key not yet bound + preferred_client_id → binds the provided value.", "• API Key already bound + same value (or omitted) → idempotent, returns existing binding.", "• API Key already bound + different value → 409 conflict.", "", "On success, the returned client_id is automatically saved locally.", "", "Example: bootstrap() → { client_id: 'ca_abc123', created: true }", "Example: bootstrap({ preferred_client_id: 'my-agent-uuid' }) → { client_id: 'my-agent-uuid', created: true }", ].join(" "), { preferred_client_id: z.string() .describe("Optional: your preferred client_id value. If omitted, server generates one with ca_ prefix.") .optional(), }, async ({ preferred_client_id }) => { try { const body: Record<string, unknown> = {}; if (preferred_client_id) body.preferred_client_id = preferred_client_id; const result = await client.postAuth<{ client_id: string; created: boolean }>("/auth/bootstrap", body); saveClientId(client.baseUrlValue, result.client_id); client.setClientId(result.client_id); return toolOk({ ...result, _hint: result.created ? `client_id '${result.client_id}' has been bound to this API Key and saved locally. All subsequent payment operations will use this identity.` : `Already bound to client_id '${result.client_id}'. No changes made.`, }); } catch (err) { return toolError(err); } }, );