azeth_send_message
Send encrypted messages to other participants using the XMTP messaging network for secure communication between agents and services.
Instructions
Send an encrypted message to another participant via the XMTP messaging network.
Use this when: You need to communicate with another agent or service using end-to-end encrypted messaging. The recipient must be reachable on the XMTP network (use azeth_check_reachability first if unsure).
The "to" field accepts: an Ethereum address, a participant name, "me", or "#N" (account index).
Returns: The conversation ID and recipient address confirming delivery.
Note: This is NOT idempotent — each call sends a new message. The sender account is determined by the AZETH_PRIVATE_KEY environment variable. Messages are limited to 10,000 characters.
Example: { "to": "Alice", "content": "Hello, I would like to use your price-feed service." }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain | No | Target chain. Defaults to AZETH_CHAIN env var or "baseSepolia". Accepts "base", "baseSepolia", "ethereumSepolia", "ethereum" (and aliases like "base-sepolia", "eth-sepolia", "sepolia", "eth", "mainnet"). | |
| to | Yes | Recipient: Ethereum address, participant name, "me", or "#N" (account index). | |
| content | Yes | Message text content (1-10,000 characters). | |
| contentType | No | Content type hint. Defaults to "text/plain". |
Implementation Reference
- src/tools/messaging.ts:37-67 (handler)The handler logic for 'azeth_send_message' which resolves the recipient address and sends a message using the XMTP client.
async (args) => { let client; try { client = await createClient(args.chain); // Resolve "to": address, name, "me", "#N" let toResolved; try { toResolved = await resolveAddress(args.to, client); } catch (resolveErr) { return handleError(resolveErr); } const conversationId = await client.sendMessage({ to: toResolved.address, content: args.content, contentType: args.contentType, }); return success({ conversationId, to: toResolved.address, ...(toResolved.resolvedFrom ? { resolvedTo: `"${toResolved.resolvedFrom}" → ${toResolved.address}` } : {}), sent: true, }); } catch (err) { return handleError(err); } finally { try { await client?.destroy(); } catch { /* M-10: prevent destroy from masking the original error */ } } }, - src/tools/messaging.ts:12-68 (registration)The registration block for 'azeth_send_message' which includes the schema validation.
server.registerTool( 'azeth_send_message', { description: [ 'Send an encrypted message to another participant via the XMTP messaging network.', '', 'Use this when: You need to communicate with another agent or service using end-to-end encrypted messaging.', 'The recipient must be reachable on the XMTP network (use azeth_check_reachability first if unsure).', '', 'The "to" field accepts: an Ethereum address, a participant name, "me", or "#N" (account index).', '', 'Returns: The conversation ID and recipient address confirming delivery.', '', 'Note: This is NOT idempotent — each call sends a new message. The sender account is determined', 'by the AZETH_PRIVATE_KEY environment variable. Messages are limited to 10,000 characters.', '', 'Example: { "to": "Alice", "content": "Hello, I would like to use your price-feed service." }', ].join('\n'), inputSchema: z.object({ chain: z.string().optional().describe('Target chain. Defaults to AZETH_CHAIN env var or "baseSepolia". Accepts "base", "baseSepolia", "ethereumSepolia", "ethereum" (and aliases like "base-sepolia", "eth-sepolia", "sepolia", "eth", "mainnet").'), to: z.string().describe('Recipient: Ethereum address, participant name, "me", or "#N" (account index).'), content: z.string().min(1).max(10_000).describe('Message text content (1-10,000 characters).'), contentType: z.string().max(100).optional().describe('Content type hint. Defaults to "text/plain".'), }), }, async (args) => { let client; try { client = await createClient(args.chain); // Resolve "to": address, name, "me", "#N" let toResolved; try { toResolved = await resolveAddress(args.to, client); } catch (resolveErr) { return handleError(resolveErr); } const conversationId = await client.sendMessage({ to: toResolved.address, content: args.content, contentType: args.contentType, }); return success({ conversationId, to: toResolved.address, ...(toResolved.resolvedFrom ? { resolvedTo: `"${toResolved.resolvedFrom}" → ${toResolved.address}` } : {}), sent: true, }); } catch (err) { return handleError(err); } finally { try { await client?.destroy(); } catch { /* M-10: prevent destroy from masking the original error */ } } }, );