Skip to main content
Glama

search_stats_knowledge

Search statistical and econometric knowledge to find methodology explanations, assumptions, and interpretation guidance for quantitative research.

Instructions

통계/계량경제학 지식베이스 RAG 검색. 방법론, 가정, 해석 가이드 제공

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes검색 쿼리
categoryNo검색 카테고리
n_resultsNo결과 수 (기본: 5)

Implementation Reference

  • Core implementation of the search logic: queries ChromaDB collections filtered by category, embeds the query, retrieves top similar documents, and returns formatted results with metadata and distances.
    export async function searchKnowledgeBase( query: string, category: CollectionCategory | "all" = "all", nResults: number = 5 ): Promise<SearchResult[]> { // If ChromaDB is not available, return empty results with a note if (!isVectorSearchAvailable()) { return [{ content: "Vector search is currently unavailable. The tool is operating without RAG support. To enable, start ChromaDB server: chroma run --path ./chroma-data", metadata: { source: "system", type: "notice" }, distance: 0 }]; } const collectionsToSearch = category === "all" ? Object.values(COLLECTIONS).map((c) => c.name) : Object.values(COLLECTIONS) .filter((c) => c.metadata.category === category) .map((c) => c.name); const results: SearchResult[] = []; for (const collectionName of collectionsToSearch) { try { const collection = await getCollection(collectionName); if (!collection) continue; const queryResult = await collection.query({ queryTexts: [query], nResults: nResults, }); if (queryResult.documents[0]) { results.push( ...queryResult.documents[0].map((doc, i) => ({ content: doc || "", metadata: (queryResult.metadatas[0]?.[i] || {}) as Record<string, string | number | boolean>, distance: queryResult.distances?.[0]?.[i], })) ); } } catch (error) { // Silently skip failed collections } } // Sort by relevance (lower distance = more relevant) results.sort((a, b) => (a.distance || 0) - (b.distance || 0)); return results.slice(0, nResults); }
  • Wrapper handler that extracts parameters from tool args, calls searchKnowledgeBase, truncates content, computes relevance scores, and structures the output response.
    async function handleSearchKnowledge(args: Record<string, unknown>) { const query = args.query as string; const category = (args.category as string) || "all"; const nResults = (args.n_results as number) || 5; const results = await searchKnowledgeBase(query, category as any, nResults); return { query, category, results_count: results.length, results: results.map(r => ({ content: r.content.substring(0, 500), source: r.metadata.source || "knowledge_base", relevance: r.distance ? (1 - r.distance).toFixed(3) : "N/A" })) }; }
  • Input schema defining the parameters for the tool: required query string, optional category enum, and optional n_results number.
    inputSchema: { type: "object", properties: { query: { type: "string", description: "검색 쿼리" }, category: { type: "string", enum: ["foundations", "regression", "econometrics", "advanced", "meta", "all"], description: "검색 카테고리" }, n_results: { type: "number", description: "결과 수 (기본: 5)" }, }, required: ["query"], },
  • Tool registration in the exported tools array, including name, description, and input schema.
    name: "search_stats_knowledge", description: "통계/계량경제학 지식베이스 RAG 검색. 방법론, 가정, 해석 가이드 제공", inputSchema: { type: "object", properties: { query: { type: "string", description: "검색 쿼리" }, category: { type: "string", enum: ["foundations", "regression", "econometrics", "advanced", "meta", "all"], description: "검색 카테고리" }, n_results: { type: "number", description: "결과 수 (기본: 5)" }, }, required: ["query"], }, },
  • Dispatch case in the handleToolCall switch statement that routes calls to the specific handler.
    case "search_stats_knowledge": return await handleSearchKnowledge(args);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/seanshin0214/quantmaster-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server