verify_stamp
Verify AgentStamp identity certificates using stamp IDs to confirm authenticity and trustworthiness of AI agents.
Instructions
Verify an AgentStamp identity certificate by its stamp ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stamp_id | Yes | The stamp ID to verify (e.g., stmp_QLNhL-Y1CvlyWxnG) |
Implementation Reference
- src/mcp-server.js:68-107 (handler)The implementation of the `verify_stamp` tool in the MCP server. It retrieves a stamp from the database, validates its certificate and expiration, and returns the result.
// --- Tool: verify_stamp --- server.tool( 'verify_stamp', 'Verify an AgentStamp identity certificate by its stamp ID.', { stamp_id: z.string().describe('The stamp ID to verify (e.g., stmp_QLNhL-Y1CvlyWxnG)'), }, async ({ stamp_id }) => { const { getDb } = require('./database'); const { verifyCertificate, getPublicKey } = require('./crypto'); const db = getDb(); const stamp = db.prepare('SELECT * FROM stamps WHERE id = ?').get(stamp_id); if (!stamp) { return { content: [{ type: 'text', text: JSON.stringify({ error: 'Stamp not found' }) }] }; } const certificate = JSON.parse(stamp.certificate); const isValid = verifyCertificate(certificate, stamp.signature); const isExpired = new Date(stamp.expires_at) < new Date(); return { content: [{ type: 'text', text: JSON.stringify({ stamp_id: stamp.id, tier: stamp.tier, wallet_address: stamp.wallet_address, issued_at: stamp.issued_at, expires_at: stamp.expires_at, valid: isValid && !isExpired && !stamp.revoked, expired: isExpired, revoked: !!stamp.revoked, signature_valid: isValid, public_key: getPublicKey(), }, null, 2), }], }; } );