get_nonce
Retrieve a nonce to verify owner wallet signatures. Provide wallet ID for multi-wallet sessions.
Instructions
Get a nonce for owner wallet signature verification.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wallet_id | No | Target wallet ID. Required for multi-wallet sessions; auto-resolved when session has a single wallet. |
Implementation Reference
- The handler function that executes the get_nonce tool logic. It takes an optional wallet_id parameter, makes a GET request to /v1/nonce on the API client, and returns the result via toToolResult.
async (args) => { const params = new URLSearchParams(); if (args.wallet_id) params.set('walletId', args.wallet_id); const qs = params.toString(); const result = await apiClient.get('/v1/nonce' + (qs ? '?' + qs : '')); return toToolResult(result); }, - Schema definition: wallet_id is an optional string parameter that specifies the target wallet ID. Required for multi-wallet sessions.
{ wallet_id: z.string().optional().describe('Target wallet ID. Required for multi-wallet sessions; auto-resolved when session has a single wallet.'), }, - packages/mcp/src/tools/get-nonce.ts:10-25 (registration)The registerGetNonce function registers the 'get_nonce' tool with the MCP server using server.tool(). Imported and called from server.ts (line 22 import, line 99 invocation).
export function registerGetNonce(server: McpServer, apiClient: ApiClient, walletContext?: WalletContext): void { server.tool( 'get_nonce', withWalletPrefix('Get a nonce for owner wallet signature verification.', walletContext?.walletName), { wallet_id: z.string().optional().describe('Target wallet ID. Required for multi-wallet sessions; auto-resolved when session has a single wallet.'), }, async (args) => { const params = new URLSearchParams(); if (args.wallet_id) params.set('walletId', args.wallet_id); const qs = params.toString(); const result = await apiClient.get('/v1/nonce' + (qs ? '?' + qs : '')); return toToolResult(result); }, ); } - packages/mcp/src/server.ts:22-22 (registration)Import of registerGetNonce from the get-nonce tool module.
import { registerGetNonce } from './tools/get-nonce.js'; - packages/mcp/src/server.ts:99-99 (registration)Invocation of registerGetNonce during server creation, passing the server instance, API client, and wallet context.
registerGetNonce(server, apiClient, walletContext);