get_stats
Retrieve detailed statistics about the indexed documents in the MCP Knowledge Base Server, including formats like PDF, DOCX, TXT, and HTML, for efficient content analysis.
Instructions
获取知识库统计信息
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- src/mcp-server.ts:294-306 (handler)MCP tool handler for 'get_stats' that calls knowledgeBase.getStats() and formats the response as text.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 } ] }; }
- src/mcp-server.ts:142-149 (registration)Tool registration for 'get_stats' in the ListToolsRequestSchema handler, defining name, description, and empty input schema.{ name: 'get_stats', description: '获取知识库统计信息', inputSchema: { type: 'object', properties: {} } }
- src/knowledge-base.ts:209-216 (helper)Implementation of getStats() method in KnowledgeBase class that computes and returns the statistics.getStats() { return { totalDocuments: this.documents.size, supportedFormats: this.config.supportedFormats, maxSearchResults: this.config.maxSearchResults, similarityThreshold: this.config.similarityThreshold }; }