Skip to main content
Glama

azeth_accounts

List and manage Azeth smart accounts with names, addresses, and token IDs for use in blockchain operations.

Instructions

List all your Azeth smart accounts with their names, addresses, and trust registry token IDs.

Use this when: You want to see all your accounts at a glance, find an account by name, or get the "#N" index for use in other tools.

Returns: Your EOA owner address and an indexed list of smart accounts. Each account shows its #N index (usable in other tools), name, address, and tokenId.

Note: This is a read-only operation. Names come from the trust registry. The owner is determined by the AZETH_PRIVATE_KEY environment variable.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainNoTarget chain. Defaults to AZETH_CHAIN env var or "baseSepolia". Accepts "base", "baseSepolia", "ethereumSepolia", "ethereum" (and aliases like "base-sepolia", "eth-sepolia", "sepolia", "eth", "mainnet").

Implementation Reference

  • Handler function for 'azeth_accounts' tool which lists all smart accounts.
    server.registerTool(
      'azeth_accounts',
      {
        description: [
          'List all your Azeth smart accounts with their names, addresses, and trust registry token IDs.',
          '',
          'Use this when: You want to see all your accounts at a glance, find an account by name,',
          'or get the "#N" index for use in other tools.',
          '',
          'Returns: Your EOA owner address and an indexed list of smart accounts.',
          'Each account shows its #N index (usable in other tools), name, address, and tokenId.',
          '',
          'Note: This is a read-only operation. Names come from the trust registry.',
          'The owner is determined by the AZETH_PRIVATE_KEY environment variable.',
        ].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").'),
        }),
      },
      async (args) => {
        let client;
        try {
          client = await createClient(args.chain);
          const accounts = await client.getSmartAccounts();
    
          if (accounts.length === 0) {
            return success({
              owner: client.address,
              accounts: [],
              message: 'No smart accounts found. Use azeth_create_account to create one.',
            });
          }
    
          // Look up name and tokenId for each account on-chain via TrustRegistryModule + ERC-8004
          const chain = resolveChain(args.chain);
          const trustRegistryAddr = AZETH_CONTRACTS[chain].trustRegistryModule;
          const identityRegistryAddr = ERC8004_REGISTRY[chain];
    
          const serverUrl = process.env['AZETH_SERVER_URL'] ?? 'https://api.azeth.ai';
          const accountDetails: Array<{
            index: number;
            address: string;
            name: string;
            entityType: string;
            tokenId: string;
          }> = [];
    
          for (let i = 0; i < accounts.length; i++) {
            const addr = accounts[i]!;
            let name = '(unregistered)';
            let entityType = 'agent';
            let tokenIdStr = '(none)';
    
            try {
              // Step 1: Get tokenId from TrustRegistryModule (on-chain)
              const tokenId = await client.publicClient.readContract({
                address: trustRegistryAddr,
                abi: TrustRegistryModuleAbi,
                functionName: 'getTokenId',
                args: [addr],
              });
    
              if (tokenId > 0n) {
                tokenIdStr = tokenId.toString();
    
                // Step 2: Get tokenURI from ERC-8004 Identity Registry (on-chain)
                try {
                  const uri = await client.publicClient.readContract({
                    address: identityRegistryAddr,
                    abi: ERC8004_TOKEN_URI_ABI,
                    functionName: 'tokenURI',
                    args: [tokenId],
                  });
                  const meta = parseAgentMetadata(uri);
                  name = meta.name;
                  entityType = meta.entityType;
                } catch {
                  // tokenURI call failed — token exists but URI unreadable
                  name = '(registered)';
                }
              }
            } catch {
              // getTokenId call failed — account not registered on this module
            }
    
            accountDetails.push({
              index: i + 1,
              address: addr,
              name,
              entityType,
              tokenId: tokenIdStr,
              ...(tokenIdStr !== '(none)' ? {
                badge: `${serverUrl}/badge/${tokenIdStr}`,
                profile: `https://azeth.ai/agent/${addr}`,
              } : {}),
            });
          }
    
          return success({
            owner: client.address,
            accounts: accountDetails,
          });
        } catch (err) {
          return handleError(err);
        } finally {
          try { await client?.destroy(); } catch (e) { process.stderr.write(`[azeth-mcp] destroy error: ${e instanceof Error ? e.message : String(e)}\n`); }
        }
      },
    );
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Since no annotations exist, description carries full burden and succeeds well: discloses 'read-only operation', explains data source ('Names come from the trust registry'), and documents auth mechanism ('owner is determined by the AZETH_PRIVATE_KEY environment variable'). Also details return structure comprehensively.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Perfectly structured with clear semantic blocks: purpose statement, usage guidance, return value specification, and behavioral notes. No redundant text; every sentence adds distinct value beyond the schema. Well front-loaded with the core action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Comprehensive for a listing tool: compensates for missing output schema by detailing exact return values (EOA owner, indexed list with #N, name, address, tokenId). Covers authentication, data provenance, and workflow integration despite zero annotations and only one optional parameter.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% for the single 'chain' parameter, which is fully documented in the schema itself. Description does not mention the parameter, but with high schema coverage, baseline 3 is appropriate—no additional semantic value needed or provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Excellent specificity: 'List all your Azeth smart accounts with their names, addresses, and trust registry token IDs' provides exact verb, resource, and scope. Clearly distinguishes from sibling creation/mutation tools like azeth_create_account or azeth_transfer.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Strong 'Use this when' section explicitly lists three scenarios (view at glance, find by name, get #N index). Mentions integration with other tools via indices. Lacks explicit 'when not to use' or named alternative tools, preventing a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/azeth-protocol/mcp-azeth'

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