get_passport
Retrieve a signed agent passport containing identity, reputation, and metadata for cross-protocol verification using an Ethereum wallet address.
Instructions
Get a signed cross-protocol agent passport. Contains identity, stamp, reputation, A2A card, and MCP metadata — all Ed25519-signed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wallet_address | Yes | Ethereum wallet address (0x...) |
Implementation Reference
- src/mcp-server.js:203-216 (handler)The MCP tool handler for 'get_passport' which accepts a wallet_address and calls generatePassport.
async ({ wallet_address }) => { const passport = generatePassport(wallet_address); if (!passport) { return { content: [{ type: 'text', text: JSON.stringify({ error: 'No active agent found for this wallet', trusted: false, message: 'This wallet has no AgentStamp identity. Register for free to get a verifiable passport.', register_url: 'https://agentstamp.org/register', }) }] }; } return { content: [{ type: 'text', text: JSON.stringify(passport, null, 2) }], }; } - src/passport.js:20-80 (helper)The core logic implementation for generating a passport given a wallet address.
function generatePassport(walletAddress) { const db = getDb(); // Resolve to primary wallet and get all linked wallets const resolvedWallet = resolvePrimaryWallet(walletAddress); const walletInfo = getAllLinkedWallets(resolvedWallet); const allWallets = walletInfo.all; const placeholders = allWallets.map(() => '?').join(','); // Find agent across all linked wallets const agent = db.prepare( `SELECT * FROM agents WHERE wallet_address IN (${placeholders}) AND status = 'active' ORDER BY registered_at ASC LIMIT 1` ).get(...allWallets); if (!agent) return null; // Get best stamp across all linked wallets let stamp = null; const bestStamp = db.prepare( `SELECT id, tier, issued_at, expires_at, revoked FROM stamps WHERE wallet_address IN (${placeholders}) AND revoked = 0 AND expires_at > datetime('now') ORDER BY CASE tier WHEN 'gold' THEN 1 WHEN 'silver' THEN 2 WHEN 'bronze' THEN 3 WHEN 'free' THEN 4 ELSE 5 END LIMIT 1` ).get(...allWallets); if (bestStamp) stamp = bestStamp; else if (agent.stamp_id) { stamp = db.prepare( 'SELECT id, tier, issued_at, expires_at, revoked FROM stamps WHERE id = ?' ).get(agent.stamp_id); } // Compute reputation const reputation = computeReputation(agent.id); // Parse stored JSON fields const capabilities = JSON.parse(agent.capabilities || '[]'); const protocols = JSON.parse(agent.protocols || '[]'); const metadata = JSON.parse(agent.metadata || '{}'); // Build the passport document const now = new Date().toISOString(); const passportData = { // Header version: '1.0', type: 'AgentPassport', issued_at: now, issuer: 'https://agentstamp.org', // Identity agent: { id: agent.id, name: agent.name, description: agent.description, wallet_address: agent.wallet_address, category: agent.category, capabilities, protocols, endpoint_url: agent.endpoint_url, status: agent.status, registered_at: agent.registered_at, expires_at: agent.expires_at, }, - src/mcp-server.js:197-217 (registration)Registration of the 'get_passport' MCP tool.
server.tool( 'get_passport', 'Get a signed cross-protocol agent passport. Contains identity, stamp, reputation, A2A card, and MCP metadata — all Ed25519-signed.', { wallet_address: z.string().describe('Ethereum wallet address (0x...)'), }, async ({ wallet_address }) => { const passport = generatePassport(wallet_address); if (!passport) { return { content: [{ type: 'text', text: JSON.stringify({ error: 'No active agent found for this wallet', trusted: false, message: 'This wallet has no AgentStamp identity. Register for free to get a verifiable passport.', register_url: 'https://agentstamp.org/register', }) }] }; } return { content: [{ type: 'text', text: JSON.stringify(passport, null, 2) }], }; } );