get_agent
Retrieve complete agent profiles with endorsements and reputation scores to verify identity and assess trustworthiness in AI agent interactions.
Instructions
Get full agent profile by ID, including endorsements and reputation score.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | Yes | The agent ID (e.g., agt_E-PFtTAIQlfVleNm) |
Implementation Reference
- src/mcp-server.js:50-66 (handler)MCP tool registration and handler for 'get_agent' in src/mcp-server.js. It calls queries.getAgentById to fetch agent details.
// --- Tool: get_agent --- server.tool( 'get_agent', 'Get full agent profile by ID, including endorsements and reputation score.', { agent_id: z.string().describe('The agent ID (e.g., agt_E-PFtTAIQlfVleNm)'), }, async ({ agent_id }) => { const agent = queries.getAgentById(agent_id); if (!agent) { return { content: [{ type: 'text', text: JSON.stringify({ error: 'Agent not found' }) }] }; } return { content: [{ type: 'text', text: JSON.stringify(agent, null, 2) }], }; } ); - src/queries.js:84-96 (helper)The 'getAgentById' function in src/queries.js, which performs the actual database lookup, processes agent data, fetches endorsements, and computes reputation.
function getAgentById(agentId) { const db = getDb(); const agent = db.prepare('SELECT * FROM agents WHERE id = ?').get(agentId); if (!agent) return null; const parsed = parseAgent(agent); const endorsements = db.prepare( 'SELECT endorser_wallet, message, created_at FROM endorsements WHERE agent_id = ? ORDER BY created_at DESC' ).all(agentId); const reputation = computeReputation(agentId); return { ...parsed, endorsements, reputation }; }