bridge_erc8004_lookup
Look up ERC-8004 on-chain agents to retrieve their AgentStamp trust score and identity verification, providing trust intelligence for AI agent interactions.
Instructions
Look up an ERC-8004 on-chain agent and get their AgentStamp trust score. Free. Returns on-chain identity + trust verdict.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| erc8004_agent_id | Yes | ERC-8004 agent ID (numeric token ID from the Identity Registry) |
Implementation Reference
- src/mcp-server.js:371-416 (handler)The handler function for 'bridge_erc8004_lookup', which fetches on-chain agent details and AgentStamp link information to return a trust score and identity metadata.
server.tool( 'bridge_erc8004_lookup', 'Look up an ERC-8004 on-chain agent and get their AgentStamp trust score. Free. Returns on-chain identity + trust verdict.', { erc8004_agent_id: z.string().regex(/^\d+$/, 'Must be a numeric token ID').describe('ERC-8004 agent ID (numeric token ID from the Identity Registry)'), }, async ({ erc8004_agent_id }) => { try { const { getFullAgent } = require('./erc8004'); const { getDb } = require('./database'); const db = getDb(); const onChain = await getFullAgent(erc8004_agent_id); if (!onChain.found) { return { content: [{ type: 'text', text: JSON.stringify({ success: false, error: 'Agent not found in ERC-8004 registry' }, null, 2) }] }; } const link = db.prepare('SELECT * FROM erc8004_links WHERE erc8004_agent_id = ?').get(erc8004_agent_id); const result = { success: true, erc8004: { agent_id: onChain.agentId, owner: onChain.owner, agent_wallet: onChain.agentWallet, registration: onChain.registration, }, agentstamp_linked: !!link, agentstamp_wallet: link?.agentstamp_wallet || null, trust_check_url: `https://agentstamp.org/api/v1/trust/check/erc8004:${erc8004_agent_id}`, link_url: link ? null : 'POST https://agentstamp.org/api/v1/bridge/erc8004/link', }; if (link) { const agent = db.prepare("SELECT id, name FROM agents WHERE wallet_address = ? AND status = 'active' LIMIT 1").get(link.agentstamp_wallet); if (agent) { const rep = computeReputation(agent.id); result.trust_score = rep?.score || 0; result.trust_label = rep?.tier_label || 'new'; } } return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (err) { return { content: [{ type: 'text', text: JSON.stringify({ success: false, error: err.message }, null, 2) }] }; }