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
| Name | Required | Description | Default |
|---|---|---|---|
| chain | No | 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 | Yes | The ERC-8004 token ID of the agent to check your opinion for. |
Implementation Reference
- src/tools/reputation.ts:430-457 (handler)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) { - src/tools/reputation.ts:425-428 (schema)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.'), }), - src/tools/reputation.ts:407-429 (registration)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.'), }), },