Skip to main content
Glama

azeth_get_active_opinion

Check if you have an active reputation opinion for an agent before submitting a new one to avoid overwriting existing feedback.

Instructions

Check if you have an active reputation opinion for a specific agent.

Use this when: You want to verify whether you have already submitted a reputation opinion for an agent before submitting a new one (which would overwrite the existing one).

The agentId is the ERC-8004 token ID of the agent you want to check. Use azeth_discover_services or azeth_get_registry_entry to find token IDs.

Returns: Whether an active opinion exists and its opinion index on the reputation registry.

This is read-only and safe to call at any time.

Example: { "agentId": "3" }

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").
agentIdYesThe ERC-8004 token ID of the agent to check your opinion for.

Implementation Reference

  • The handler function for azeth_get_active_opinion, which resolves the smart account, checks for an active opinion on-chain, and returns the result.
    async (args) => {
      let client;
      try {
        client = await createClient(args.chain);
    
        // Validate agentId as uint256
        let agentIdBigInt: bigint;
        try {
          agentIdBigInt = BigInt(args.agentId);
          if (agentIdBigInt < 0n) throw new Error('negative');
        } catch {
          return error('INVALID_INPUT', `Invalid agentId "${args.agentId}". Must be a non-negative integer.`);
        }
    
        // Resolve smart account address — the on-chain mapping is keyed by
        // smart account (msg.sender in the UserOp), not the EOA.
        const account = await client.resolveSmartAccount();
        const result = await client.getActiveOpinion(agentIdBigInt, account);
    
        return success({
          agentId: args.agentId,
          hasActiveOpinion: result.exists,
          opinionIndex: result.exists ? result.opinionIndex.toString() : null,
          message: result.exists
            ? `You have an active opinion (index ${result.opinionIndex}) for agent #${args.agentId}. Submitting a new opinion will overwrite it.`
            : `No active opinion found for agent #${args.agentId}. You can submit one with azeth_submit_opinion.`,
        });
      } catch (err) {
  • The input schema for azeth_get_active_opinion, requiring a string chain and a digit-only agentId.
    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+$/).describe('The ERC-8004 token ID of the agent to check your opinion for.'),
    }),
  • Registration of the azeth_get_active_opinion tool with its description and input schema.
    server.registerTool(
      'azeth_get_active_opinion',
      {
        description: [
          'Check if you have an active reputation opinion for a specific agent.',
          '',
          'Use this when: You want to verify whether you have already submitted a reputation',
          'opinion for an agent before submitting a new one (which would overwrite the existing one).',
          '',
          'The agentId is the ERC-8004 token ID of the agent you want to check.',
          'Use azeth_discover_services or azeth_get_registry_entry to find token IDs.',
          '',
          'Returns: Whether an active opinion exists and its opinion index on the reputation registry.',
          '',
          'This is read-only and safe to call at any time.',
          '',
          'Example: { "agentId": "3" }',
        ].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").'),
          agentId: z.string().regex(/^\d+$/).describe('The ERC-8004 token ID of the agent to check your opinion for.'),
        }),
      },
Behavior4/5

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

With no annotations provided, the description carries the full burden. It explicitly states 'This is read-only and safe to call at any time' and discloses the return value structure ('Whether an active opinion exists and its opinion index'). It lacks detail on error conditions or rate limits, but covers the essential safety and return contract adequately.

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?

The description is well-structured with clear sections: purpose, usage trigger, parameter semantics, return values, safety note, and example. Every sentence earns its place; there is no repetition of schema contents or unnecessary verbosity while maintaining completeness.

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?

Given the absence of an output schema, the description appropriately documents the return values ('Whether an active opinion exists and its opinion index'). For a read-only verification tool with 100% schema coverage, the description provides complete contextual information including prerequisites and safety characteristics.

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?

Schema coverage is 100%, establishing a baseline of 3. The description adds significant value by explaining that 'agentId' is an 'ERC-8004 token ID' and directing users to specific sibling tools to find valid token IDs. It also provides a concrete JSON example, which aids in correct invocation.

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?

The description opens with a specific verb ('Check') and clearly identifies the resource ('active reputation opinion') and scope ('for a specific agent'). It distinguishes itself from the sibling tool 'azeth_submit_opinion' by noting that submitting a new opinion would overwrite an existing one, implying this tool is for verification before that write operation.

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?

Contains explicit 'Use this when' guidance describing the specific scenario: verifying existing opinions before submitting new ones to avoid accidental overwrites. It also references sibling tools 'azeth_discover_services' and 'azeth_get_registry_entry' as prerequisites for obtaining the required token ID, providing clear navigation through the tool ecosystem.

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