Skip to main content
Glama
ikungsjl

MCP Knowledge Base Server

by ikungsjl

get_stats

Retrieve statistical information about indexed documents in the knowledge base, including counts and processing status for various file formats.

Instructions

获取知识库统计信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that returns statistics for the knowledge base: total documents, supported formats, max search results, and similarity threshold.
    getStats() {
      return {
        totalDocuments: this.documents.size,
        supportedFormats: this.config.supportedFormats,
        maxSearchResults: this.config.maxSearchResults,
        similarityThreshold: this.config.similarityThreshold
      };
    }
  • Registration of the 'get_stats' tool in the ListTools response, including name, description, and empty input schema.
    {
      name: 'get_stats',
      description: '获取知识库统计信息',
      inputSchema: {
        type: 'object',
        properties: {}
      }
    }
  • MCP CallTool handler for 'get_stats', which calls knowledgeBase.getStats() and formats the response as text content.
    case 'get_stats': {
      const stats = this.knowledgeBase.getStats();
      const resultText = `知识库统计信息:\n\n总文档数: ${stats.totalDocuments}\n支持格式: ${stats.supportedFormats.join(', ')}\n最大搜索结果数: ${stats.maxSearchResults}\n相似度阈值: ${stats.similarityThreshold}`;
    
      return {
        content: [
          {
            type: 'text',
            text: resultText
          }
        ]
      };
    }
  • Input schema for get_stats tool: an empty object (no parameters required).
    inputSchema: {
      type: 'object',
      properties: {}
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it 'gets' statistics, implying a read-only operation, but doesn't specify what statistics are returned (e.g., counts, sizes, types), whether it requires permissions, or any rate limits. This leaves significant gaps for a tool that likely provides critical system information.

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 a single, efficient sentence in Chinese ('获取知识库统计信息'), which is appropriately sized for a simple tool. It's front-loaded with the core action, though it could be slightly more informative without losing conciseness.

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 likely complexity (providing statistics for a knowledge base with multiple sibling tools), no annotations, and no output schema, the description is incomplete. It doesn't explain what statistics are returned, their format, or how this tool fits into the broader context of managing the knowledge base, leaving the agent with insufficient guidance.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add param info, but that's appropriate here. Baseline is 4 for 0 params, as it avoids unnecessary detail and matches the schema's simplicity.

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

Purpose3/5

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

The description '获取知识库统计信息' (Get knowledge base statistics) states a clear verb ('get') and resource ('knowledge base statistics'), but it's somewhat vague about what specific statistics are retrieved. It doesn't differentiate from sibling tools like 'list_documents' or 'query_knowledge_base' that might also provide statistical information, though it's more specific than just 'process'.

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. It doesn't mention prerequisites, context, or exclusions, such as whether it's for summary metrics versus detailed listings, or how it compares to siblings like 'list_documents' for counting documents.

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/ikungsjl/mcp-knowledge-base'

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