Skip to main content
Glama

azeth_update_service_batch

Update multiple service metadata fields in one transaction to save gas costs when modifying endpoint, description, capabilities, name, entityType, or pricing.

Instructions

Update multiple metadata fields for your registered service in a single transaction.

Use this when: You need to change several metadata fields at once (e.g., endpoint + description + capabilities). This is more gas-efficient than calling azeth_update_service multiple times.

Supported metadata keys: "endpoint", "description", "capabilities", "name", "entityType", "pricing". For capabilities, provide a JSON array string (e.g., '["translation", "nlp"]').

Note: Catalogs are off-chain. Update your catalog by updating your endpoint response.

Returns: Confirmation with a single transaction hash for all updates.

Note: All updates are atomic — if one fails, none are applied. Maximum 5 key-value pairs per batch.

Example: { "updates": [{"key": "endpoint", "value": "https://api.example.com/v2"}, {"key": "description", "value": "Updated service"}] }

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").
updatesYesArray of {key, value} pairs to update. Max 5 updates per batch.

Implementation Reference

  • The handler function for 'azeth_update_service_batch' which uses client.updateServiceMetadataBatch to execute the updates.
    async (args) => {
      let client;
      try {
        client = await createClient(args.chain);
    
        const txHash = await client.updateServiceMetadataBatch(
          args.updates as Array<{ key: string; value: string }>,
        );
    
        return success({
          updates: (args.updates as Array<{ key: string; value: string }>).map(u => ({
            key: u.key,
            value: u.value,
          })),
          count: (args.updates as Array<{ key: string; value: string }>).length,
          message: `${(args.updates as Array<{ key: string; value: string }>).length} metadata field(s) updated in a single transaction.`,
        }, { txHash });
      } catch (err) {
        return handleError(err);
      } finally {
        try { await client?.destroy(); } catch { /* M-10 */ }
      }
  • Input schema definition for the 'azeth_update_service_batch' tool, enforcing a maximum of 5 updates and specific allowed keys.
    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").'),
      updates: z.preprocess(
        (val) => typeof val === 'string' ? JSON.parse(val) : val,
        z.array(z.object({
          key: z.enum(['endpoint', 'description', 'capabilities', 'name', 'entityType', 'pricing']),
          value: z.string().min(1).max(2048),
        })).min(1).max(5),
      ).describe('Array of {key, value} pairs to update. Max 5 updates per batch.'),
    }),
  • Registration of the 'azeth_update_service_batch' tool in the MCP server.
    server.registerTool(
      'azeth_update_service_batch',
      {
        description: [
          'Update multiple metadata fields for your registered service in a single transaction.',
          '',
          'Use this when: You need to change several metadata fields at once (e.g., endpoint + description + capabilities).',
          'This is more gas-efficient than calling azeth_update_service multiple times.',
          '',
          'Supported metadata keys: "endpoint", "description", "capabilities", "name", "entityType", "pricing".',
          'For capabilities, provide a JSON array string (e.g., \'["translation", "nlp"]\').',
          '',
          'Note: Catalogs are off-chain. Update your catalog by updating your endpoint response.',
          '',
          'Returns: Confirmation with a single transaction hash for all updates.',
          '',
          'Note: All updates are atomic — if one fails, none are applied.',
          'Maximum 5 key-value pairs per batch.',
          '',
          'Example: { "updates": [{"key": "endpoint", "value": "https://api.example.com/v2"}, {"key": "description", "value": "Updated 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").'),
          updates: z.preprocess(
            (val) => typeof val === 'string' ? JSON.parse(val) : val,
            z.array(z.object({
              key: z.enum(['endpoint', 'description', 'capabilities', 'name', 'entityType', 'pricing']),
              value: z.string().min(1).max(2048),
            })).min(1).max(5),
          ).describe('Array of {key, value} pairs to update. Max 5 updates per batch.'),
        }),
      },

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