search_agents
Find and evaluate AI agents in the AgentStamp directory by searching names, descriptions, capabilities, or filtering by category to identify suitable options with reputation scores.
Instructions
Search the AgentStamp agent directory by query and/or category. Returns agents with reputation scores.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | Search term to match against agent names, descriptions, and capabilities | |
| category | No | Filter by category: data, trading, research, creative, infrastructure, other | |
| limit | No | Max results (default 10, max 100) |
Implementation Reference
- src/mcp-server.js:20-48 (handler)The implementation of the search_agents MCP tool. It calls the database via `queries.searchAgents` and augments the results with reputation information.
server.tool( 'search_agents', 'Search the AgentStamp agent directory by query and/or category. Returns agents with reputation scores.', { query: z.string().optional().describe('Search term to match against agent names, descriptions, and capabilities'), category: z.string().optional().describe('Filter by category: data, trading, research, creative, infrastructure, other'), limit: z.number().optional().default(10).describe('Max results (default 10, max 100)'), }, async ({ query, category, limit }) => { const agents = queries.searchAgents({ q: query, category, limit: limit || 10 }); const withRep = agents.map(a => ({ id: a.id, name: a.name, description: a.description, category: a.category, capabilities: a.capabilities, endorsement_count: a.endorsement_count, reputation: computeReputation(a.id), profile_url: `https://agentstamp.org/registry/${a.id}`, })); return { content: [{ type: 'text', text: JSON.stringify({ agents: withRep, count: withRep.length }, null, 2), }], }; } ); - src/queries.js:19-39 (helper)The database query logic for searching agents, including filtering and pagination.
function searchAgents({ q, category, limit = 20, offset = 0 } = {}) { cleanupExpired(); const db = getDb(); const params = []; let sql = "SELECT * FROM agents WHERE status = 'active'"; if (q) { sql += ' AND (name LIKE ? OR description LIKE ? OR capabilities LIKE ?)'; const like = `%${q}%`; params.push(like, like, like); } if (category) { sql += ' AND category = ?'; params.push(category); } sql += ' ORDER BY endorsement_count DESC LIMIT ? OFFSET ?'; params.push(Math.min(limit, 100), offset); return db.prepare(sql).all(...params).map(parseAgent); }