Skip to main content
Glama

kb_import

Import structured knowledge base data from JSON to enable AI agents to maintain persistent context and long-term memory across sessions.

Instructions

Import knowledge base from JSON string

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesJSON string of knowledge base data

Implementation Reference

  • Core handler logic for importing knowledge base: parses JSON input, performs basic structure validation, replaces current KB, and persists to disk via save().
    async importKnowledgeBase(data: string): Promise<void> { try { const imported = JSON.parse(data); // Validate the structure if (imported.version && imported.personal !== undefined) { this.kb = imported; await this.save(); } else { throw new Error('Invalid knowledge base format'); } } catch (error) { throw new Error(`Failed to import knowledge base: ${error}`); } }
  • Tool dispatcher case that extracts the 'data' parameter from tool arguments and delegates to KnowledgeManager.importKnowledgeBase, returning success message.
    case 'kb_import': { const { data } = args as any; await km.importKnowledgeBase(data); return { content: [ { type: 'text', text: '✅ Knowledge base imported successfully' } ] }; }
  • Tool definition including name, description, and input schema specifying required 'data' field as JSON string.
    { name: 'kb_import', description: 'Import knowledge base from JSON string', inputSchema: { type: 'object', properties: { data: { type: 'string', description: 'JSON string of knowledge base data' } }, required: ['data'] }
  • src/index.ts:423-425 (registration)
    Registration of ListToolsRequestHandler that returns the tools array containing kb_import.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { 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/hlsitechio/mcp-instruct'

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