clear_knowledge_base
Easily clear indexed documents and data from the knowledge base on the MCP Knowledge Base Server, enabling a reset or fresh start for document processing and querying tasks.
Instructions
清空知识库
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- src/mcp-server.ts:282-292 (handler)MCP tool handler for 'clear_knowledge_base' that calls the KnowledgeBase.clear() method and returns a success message.case 'clear_knowledge_base': { await this.knowledgeBase.clear(); return { content: [ { type: 'text', text: '知识库已清空' } ] }; }
- src/mcp-server.ts:134-141 (registration)Registration of the 'clear_knowledge_base' tool in the ListTools response, including its schema (empty input).{ name: 'clear_knowledge_base', description: '清空知识库', inputSchema: { type: 'object', properties: {} } },
- src/knowledge-base.ts:178-181 (helper)Core helper method in KnowledgeBase class that clears the in-memory documents map and persists the empty state to index file.async clear(): Promise<void> { this.documents.clear(); await this.saveIndex(); }