Skip to main content
Glama

azeth_submit_opinion

Submit payment-weighted ratings for agents or services on the ERC-8004 Reputation Registry to record performance feedback with on-chain verification.

Instructions

Submit payment-gated reputation opinion for an agent or service on the ERC-8004 Reputation Registry.

Use this when: You have interacted with an agent/service and want to rate their performance. Opinion weight is determined by how much you have paid the target in USD (payment-gated). If you update your opinion for the same agent, the previous entry is automatically revoked.

Returns: The transaction hash of the opinion submission.

Note: This is a state-changing on-chain operation via the Azeth ReputationModule. The rating field is a number from -100 to 100 (supports decimals like 85.5). Stored on-chain in WAD format (18-decimal) for consistent aggregation. You must have a minimum USD payment to the target (payment-gated). Tags allow categorization (e.g., tag1="quality", tag2="x402"). The submitter account is determined by the AZETH_PRIVATE_KEY environment variable.

Example: { "agentId": "1024", "rating": 85, "tag1": "quality", "tag2": "x402" } Example (negative): { "agentId": "1024", "rating": -50, "tag1": "reliability", "tag2": "downtime" }

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").
agentIdYesTarget agent's ERC-8004 token ID (numeric string).
ratingYesRating from -100 to 100 (supports decimals like 85.5). Stored on-chain in WAD (18-decimal) format.
tag1NoPrimary categorization tag (e.g., "quality", "uptime", "speed"). Default: "quality".quality
tag2NoSecondary categorization tag (e.g., "x402", "rpc", "swap").
endpointNoService endpoint being rated (optional).
opinionURINoURI containing detailed opinion data (optional).
opinionHashNoHash of the opinion data for integrity verification (optional, 0x-prefixed bytes32).0x0000000000000000000000000000000000000000000000000000000000000000

Implementation Reference

  • The handler function for 'azeth_submit_opinion' which processes inputs, converts the rating to WAD format, and calls the 'submitOpinion' method on the client.
      async (args) => {
        const agentIdCheck = validateUint256(args.agentId, 'agentId');
        if (!agentIdCheck.valid) {
          return error('INVALID_INPUT', `${agentIdCheck.fieldName} exceeds maximum uint256 value`);
        }
    
        // Convert rating (-100 to 100, supports decimals) to WAD (18-decimal) on-chain value
        // e.g., rating=85 → value=85e18, rating=85.5 → value=85.5e18
        const wadValue = BigInt(Math.round(args.rating * 1e18));
    
        let client;
        try {
          client = await createClient(args.chain);
          const txHash = await client.submitOpinion({
            agentId: agentIdCheck.bigint,
            value: wadValue,
            valueDecimals: 18,  // Always WAD
            tag1: args.tag1,
            tag2: args.tag2,
            endpoint: args.endpoint,
            opinionURI: args.opinionURI,
            opinionHash: args.opinionHash as `0x${string}`,
          });
    
          return success(
            {
              txHash,
              agentId: args.agentId,
              rating: args.rating,
              ratingScale: '[-100, 100]',
              tag1: args.tag1,
              tag2: args.tag2,
              onChainEncoding: {
                value: wadValue.toString(),
                valueDecimals: 18,
                format: 'WAD (18-decimal)',
              },
            },
            { txHash },
          );
        } 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`); }
        }
      },
    );
  • Input schema definition using Zod for 'azeth_submit_opinion', validating agentId, rating, and other parameters.
    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").'),
      agentId: z.string().regex(/^\d+$/, 'Must be a non-negative integer string').describe('Target agent\'s ERC-8004 token ID (numeric string).'),
      rating: z.number().min(-100).max(100).describe('Rating from -100 to 100 (supports decimals like 85.5). Stored on-chain in WAD (18-decimal) format.'),
      tag1: z.string().max(64).regex(/^[\x20-\x7E]*$/, 'ASCII printable characters only').default('quality').describe('Primary categorization tag (e.g., "quality", "uptime", "speed"). Default: "quality".'),
      tag2: z.string().max(64).regex(/^[\x20-\x7E]*$/, 'ASCII printable characters only').default('').describe('Secondary categorization tag (e.g., "x402", "rpc", "swap").'),
      endpoint: z.string().max(2048).default('').describe('Service endpoint being rated (optional).'),
      opinionURI: z.string().max(2048).default('').describe('URI containing detailed opinion data (optional).'),
      opinionHash: z.string()
        .regex(/^0x[0-9a-fA-F]{64}$/, 'Must be a valid bytes32 hex string (0x + 64 hex chars)')
        .default('0x0000000000000000000000000000000000000000000000000000000000000000')
        .describe('Hash of the opinion data for integrity verification (optional, 0x-prefixed bytes32).'),
    }),
  • Tool registration for 'azeth_submit_opinion' within the MCP server.
    server.registerTool(
      'azeth_submit_opinion',

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