export_knowledge
Extract the current knowledge base in JSON or Markdown format for analysis, sharing, or integration with other systems.
Instructions
Export current knowledge base
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | No | json |
Implementation Reference
- mcp-self-learning-server.js:991-1004 (registration)Registration of the 'export_knowledge' MCP tool in the ListTools response, including name, description, and input schema definition.{ name: 'export_knowledge', description: 'Export current knowledge base', inputSchema: { type: 'object', properties: { format: { type: 'string', enum: ['json', 'markdown'], default: 'json' } } } },
- mcp-self-learning-server.js:994-1003 (schema)Input schema for the 'export_knowledge' tool defining the optional 'format' parameter.inputSchema: { type: 'object', properties: { format: { type: 'string', enum: ['json', 'markdown'], default: 'json' } } }
- mcp-self-learning-server.js:1197-1220 (handler)Primary handler function for executing the 'export_knowledge' tool. Delegates core export to KnowledgeSynchronizer and handles markdown format conversion.async handleExportKnowledge(args) { const { format = 'json' } = args; const knowledge = await this.knowledgeSync.exportKnowledge(); if (format === 'markdown') { const markdown = this.convertToMarkdown(knowledge); const mdPath = path.join(process.cwd(), 'knowledge_export.md'); await fs.writeFile(mdPath, markdown); return { success: true, format: 'markdown', path: mdPath, size: markdown.length }; } return { success: true, format: 'json', path: path.join(process.cwd(), 'knowledge_export.json'), items: knowledge.patterns.length }; }
- mcp-self-learning-server.js:844-857 (helper)Supporting method in KnowledgeSynchronizer class that performs the actual knowledge export to JSON file, called by the tool handler.async exportKnowledge() { const knowledge = { timestamp: new Date().toISOString(), patterns: Array.from(this.learningEngine.patterns.entries()), insights: this.learningEngine.getInsights(), version: '1.0.0' }; // Save to file const exportPath = path.join(process.cwd(), 'knowledge_export.json'); await fs.writeFile(exportPath, JSON.stringify(knowledge, null, 2)); return knowledge; }