Skip to main content
Glama
seanshin0214

Dr. QuantMaster MCP Server

by seanshin0214

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);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the tool provides '방법론, 가정, 해석 가이드' which gives some context about output content, but doesn't describe the search behavior (e.g., is it semantic search? keyword-based?), result format, limitations, or any operational constraints. For a search tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise with two clear phrases that efficiently convey the core functionality. It's front-loaded with the main purpose ('통계/계량경제학 지식베이스 RAG 검색') followed by the value proposition. No wasted words, though it could benefit from slightly more structure.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (knowledge search with filtering), lack of annotations, and no output schema, the description is insufficiently complete. It doesn't explain what the search returns (snippets? full documents? citations?), how results are ranked, what the knowledge base contains, or any limitations. For a search tool in a domain-specific context, this leaves too many unanswered questions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema. The baseline score of 3 is appropriate when the schema does the heavy lifting, though the description could have explained parameter interactions or provided examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '통계/계량경제학 지식베이스 RAG 검색' (statistics/econometrics knowledge base RAG search) and specifies it provides '방법론, 가정, 해석 가이드' (methodology, assumptions, interpretation guides). It distinguishes from siblings by focusing on knowledge retrieval rather than calculation, analysis, or code generation tools. However, it doesn't explicitly differentiate from potential similar search tools (none appear in the sibling list).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. While the purpose suggests it's for retrieving methodological knowledge, there's no mention of when to choose this over other knowledge-focused tools like 'get_method_guide' or 'suggest_method' from the sibling list. No exclusions, prerequisites, or contextual boundaries are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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