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',
Behavior5/5

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

With no annotations provided, description carries full burden: states 'state-changing on-chain operation', discloses auto-revocation of previous entries, notes AZETH_PRIVATE_KEY auth requirement, explains payment-gating mechanism, and specifies transaction hash return.

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

Conciseness4/5

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

Well-structured with clear sections (purpose, usage, returns, notes, examples). Slightly verbose but justified by complexity (8 params, blockchain mutation). Every sentence adds value; front-loaded with critical behavioral constraints.

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?

Excellent coverage for a complex state-changing operation: covers prerequisites (payment, auth), side effects (revocation), data formats (WAD), and return values. No output schema exists but return value is documented.

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

Parameters4/5

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

Despite 100% schema coverage, adds crucial context: rating range (-100 to 100, decimals), WAD format storage details, tag usage examples ('quality', 'x402'), and private key environment variable dependency.

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?

Specific verb 'Submit' combined with precise resource 'payment-gated reputation opinion' and target 'ERC-8004 Reputation Registry' clearly distinguishes this from sibling tools like 'azeth_get_active_opinion' or 'azeth_publish_service'.

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

Usage Guidelines5/5

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

Explicit 'Use this when' clause ('interacted with an agent/service and want to rate') and prerequisites ('must have a minimum USD payment to the target'). Also clarifies update semantics vs. alternatives ('previous entry is automatically revoked').

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