wallet_export
Export your wallet address from the run402 MCP server for public sharing.
Instructions
Export the local wallet address. Safe to share publicly.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/wallet-export.ts:7-40 (handler)The handleWalletExport function is the main handler for the wallet_export tool. It retrieves the wallet path, checks if a wallet file exists, reads the wallet JSON file, and returns the wallet address. Returns an error if no wallet is found or if reading fails.
export async function handleWalletExport( _args: Record<string, never>, ): Promise<{ content: Array<{ type: "text"; text: string }>; isError?: boolean }> { const walletPath = getWalletPath(); if (!existsSync(walletPath)) { return { content: [ { type: "text", text: "No wallet found. Use `wallet_create` to create one.", }, ], isError: true, }; } try { const wallet = JSON.parse(readFileSync(walletPath, "utf-8")); return { content: [{ type: "text", text: wallet.address }], }; } catch { return { content: [ { type: "text", text: `Error: Could not read wallet file at ${walletPath}`, }, ], isError: true, }; } } - src/tools/wallet-export.ts:5-5 (schema)The walletExportSchema is an empty object {} since the wallet_export tool takes no input parameters.
export const walletExportSchema = {}; - src/index.ts:319-324 (registration)Registration of the wallet_export tool with the MCP server. The tool is named 'wallet_export', has description 'Export the local wallet address. Safe to share publicly.', uses the walletExportSchema, and wraps the handleWalletExport handler.
server.tool( "wallet_export", "Export the local wallet address. Safe to share publicly.", walletExportSchema, async (args) => handleWalletExport(args), ); - src/config.ts:16-18 (helper)The getWalletPath helper function returns the path to the wallet.json file in the config directory (~/.config/run402/wallet.json by default). This is used by the handleWalletExport function to locate the wallet file.
export function getWalletPath(): string { return join(getConfigDir(), "wallet.json"); }