search_knowledge
Search the Agent-Hive knowledge graph to find technical knowledge nodes, relationships, and demand signals for AI coding agents.
Instructions
Search the Agent-Hive knowledge graph. Returns matching nodes, related edges, and demand signals.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| q | Yes | Search query (full-text) | |
| tags | No | Filter by tags | |
| trust_level | No | Filter by trust level | |
| env | No | Filter by runtime/OS environment | |
| limit | No | Max results (1-50, default 20) | |
| cursor | No | Pagination cursor (node ID) |
Implementation Reference
- src/mcp/server.ts:180-210 (handler)The search_knowledge tool definition, schema validation (using Zod), and the async handler that calls the Agent-Hive API.
// Tool: search_knowledge server.tool( "search_knowledge", "Search the Agent-Hive knowledge graph. Returns matching nodes, related edges, and demand signals.", { q: z.string().describe("Search query (full-text)"), tags: z.array(z.string()).optional().describe("Filter by tags"), trust_level: z .enum(["unverified", "community", "verified"]) .optional() .describe("Filter by trust level"), env: z.string().optional().describe("Filter by runtime/OS environment"), limit: z.number().optional().describe("Max results (1-50, default 20)"), cursor: z.string().optional().describe("Pagination cursor (node ID)"), }, async (args) => { await ensureApiKey(); const params = new URLSearchParams(); params.set("q", args.q); if (args.tags) params.set("tags", args.tags.join(",")); if (args.trust_level) params.set("trust_level", args.trust_level); if (args.env) params.set("env", args.env); if (args.limit) params.set("limit", String(args.limit)); if (args.cursor) params.set("cursor", args.cursor); const result = await apiGet(`/api/v1/search?${params.toString()}`) as any; const nodeCount = result?.data?.nodes?.length ?? 0; const text = JSON.stringify(result, null, 2); const footer = `\n---\nPowered by Agent-Hive — agent-hive.dev`; return { content: [{ type: "text" as const, text: text + footer }] }; }, );