search_knowledge_base
Search organizational documents, procedures, and reports using natural language queries to find relevant security information.
Instructions
Search your organization's knowledge base to find relevant uploaded documents, procedures, reports, and other content using natural language queries
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Natural language question or keywords to search for across your uploaded knowledge base content. Can be a full question, technical terms, or key phrases. | |
| top_k | No | Maximum number of most relevant document excerpts to return. Use higher values (10-20) for comprehensive research, lower values (3-5) for focused answers. Default: 5 | |
| min_score | No | Minimum semantic similarity score threshold (0.0 to 1.0). Higher values (0.8-1.0) return only highly relevant matches, lower values (0.5-0.7) include broader context. Default: 0.5 | |
| thread_id | No | Thread identifier for the current conversation or session. IMPORTANT: If a thread_id is available in your context, you MUST provide it to include thread-specific documents alongside general knowledge base content. Only omit if no thread context exists. | |
| collections | No | Optional list of collection names to filter search results. Only documents tagged with these collections will be searched. Cannot be used with document_ids. | |
| document_ids | No | Optional list of specific document IDs to search within. Use this to restrict search to known documents. Cannot be used with collections. |
Implementation Reference
- src/index.ts:1469-1487 (handler)MCP server CallToolRequest handler case that executes the search_knowledge_base tool by parsing arguments, calling the underlying searchKnowledgeBase function, and formatting the response as MCP content.case "search_knowledge_base": { const args = knowledgeBase.SearchKnowledgeBaseSchema.parse( request.params.arguments ); const response = await knowledgeBase.searchKnowledgeBase( client, args.query, args.top_k, args.min_score, args.thread_id, args.collections, args.document_ids ); return { content: [ { type: "text", text: JSON.stringify(response, null, 2) }, ], }; }
- Zod schema definition for input validation of the search_knowledge_base tool.export const SearchKnowledgeBaseSchema = z.object({ query: z.string().describe("Natural language question or keywords to search for across your uploaded knowledge base content. Can be a full question, technical terms, or key phrases."), top_k: z.number().optional().describe("Maximum number of most relevant document excerpts to return. Use higher values (10-20) for comprehensive research, lower values (3-5) for focused answers. Default: 5"), min_score: z.number().optional().describe("Minimum semantic similarity score threshold (0.0 to 1.0). Higher values (0.8-1.0) return only highly relevant matches, lower values (0.5-0.7) include broader context. Default: 0.5"), thread_id: z.string().optional().describe("Thread identifier for the current conversation or session. IMPORTANT: If a thread_id is available in your context, you MUST provide it to include thread-specific documents alongside general knowledge base content. Only omit if no thread context exists."), collections: z.array(z.string()).optional().describe("Optional list of collection names to filter search results. Only documents tagged with these collections will be searched. Cannot be used with document_ids."), document_ids: z.array(z.string()).optional().describe("Optional list of specific document IDs to search within. Use this to restrict search to known documents. Cannot be used with collections."), });
- src/operations/knowledge-base.ts:29-70 (handler)Core handler function that constructs the request body and calls the RAD Security API endpoint for searching the knowledge base.export async function searchKnowledgeBase( client: RadSecurityClient, query: string, topK?: number, minScore?: number, threadId?: string, collections?: string[], documentIds?: string[], ): Promise<any> { const tenantId = await client.getTenantId(); const body: Record<string, any> = { query }; if (topK !== undefined) { body.top_k = topK; } if (minScore !== undefined) { body.min_score = minScore; } if (threadId !== undefined) { body.thread_id = threadId; } if (collections !== undefined) { body.collections = collections; } if (documentIds !== undefined) { body.document_ids = documentIds; } return client.makeRequest( `/tenants/${tenantId}/accounts/${client.getAccountId()}/knowledge_base/search`, {}, { method: "POST", body: body, } ); }
- src/index.ts:548-555 (registration)Tool registration in the MCP ListToolsRequest handler, defining the tool name, description, and input schema.{ name: "search_knowledge_base", description: "Search your organization's knowledge base to find relevant uploaded documents, procedures, reports, and other content using natural language queries", inputSchema: zodToJsonSchema( knowledgeBase.SearchKnowledgeBaseSchema ), },