clear_knowledge_base
Remove all indexed documents from the MCP Knowledge Base Server to reset the knowledge base for new content processing.
Instructions
清空知识库
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "clear_knowledge_base"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp-server.ts:282-292 (handler)Handler for the 'clear_knowledge_base' tool call. Invokes KnowledgeBase.clear() and returns a success message indicating the knowledge base has been cleared.
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, defining its name, description, and empty input schema.
{ name: 'clear_knowledge_base', description: '清空知识库', inputSchema: { type: 'object', properties: {} } }, - src/knowledge-base.ts:178-181 (helper)Core implementation of clearing the knowledge base: empties the in-memory documents Map and persists the empty state by calling saveIndex().
async clear(): Promise<void> { this.documents.clear(); await this.saveIndex(); }