get_agent
Retrieve complete agent profiles with endorsements and reputation scores to verify identity and trustworthiness in AI agent networks.
Instructions
Get full agent profile by ID, including endorsements and reputation score.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | Yes | The agent ID (e.g., agt_E-PFtTAIQlfVleNm) |
Implementation Reference
- src/queries.js:73-85 (handler)The implementation of the getAgentById function which fetches the full agent profile, including endorsements and reputation, used by the "get_agent" MCP tool.
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 }; } - src/mcp-server.js:50-66 (registration)Registration and MCP tool handler logic for 'get_agent'. It calls the queries.getAgentById method to retrieve the agent data.
// --- 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) }], }; } );