Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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,
        };
      }
    }
  • 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),
    );
  • 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");
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kychee-com/run402'

If you have feedback or need assistance with the MCP directory API, please join our Discord server