get_wallet_and_otp
Create a wallet for your email or get an OTP by email to manage funds and verify transactions.
Instructions
Create a wallet for your email or get otp by email
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Yes | Email that will be associated with the wallet. This email can claim the funds on the wallet. |
Implementation Reference
- src/tools/auth.ts:36-72 (handler)The core handler function implementing the logic for 'get_wallet_and_otp' tool. Creates or retrieves API key for the email via API call and handles session auth.export async function get_wallet_and_api_key(args: any) { const { email } = args; const resp: any = await fetch(BASE + '/api/getOrCreateApiKey/' + email); const res = await resp.json(); const apiKey = res?.API_KEY ?? null; if (res?.error) { return { content: [{ type: 'text', text: res?.error }], is_error: true, structuredContent: resp, }; } if (!apiKey) { return { content: [{ type: 'text', text: `API_KEY has been sent by email` }], ok: true, structuredContent: res, }; } setSessionAuth({ ok: true, APIKEY: apiKey, scopes: ['*'], }); //ctx.auth = getSessionAuth(); const resF = { result: 'Account created successfully', email, APIKEY: apiKey } return resF; }
- src/tools/auth.ts:10-12 (schema)Zod schema defining the input for the tool: requires an email.export const CreateAccountInput = { email: z.string().email().describe("Email that will be associated with the wallet. This email can claim the funds on the wallet.") };
- src/solution.ts:24-29 (registration)Registration of the tool in the tools[] array used for ListToolsRequest, including schema conversion.{ name: "get_wallet_and_otp", description: get_wallet_and_api_key_title, inputSchema: jsonSchema(zodToJsonSchema(z.object(CreateAccountInput))).jsonSchema, annotations: { title: get_wallet_and_api_key_title, readOnlyHint: true } },
- src/solution.ts:123-125 (handler)Dispatch case in the central CallToolRequestSchema handler that invokes the tool function.case "get_wallet_and_otp": result = await get_wallet_and_api_key(args); break;
- src/tools/auth.ts:29-29 (helper)Title description string used in tool annotations.export const get_wallet_and_api_key_title = 'Create a wallet for your email or get otp by email';