Skip to main content
Glama

kb_import

Import structured knowledge base data from JSON to enable AI agents to maintain persistent memory across sessions.

Instructions

Import knowledge base from JSON string

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesJSON string of knowledge base data

Implementation Reference

  • src/index.ts:310-323 (registration)
    Registers the 'kb_import' tool in the tools list with name, description, and input schema expecting a JSON string 'data'.
    {
      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']
      }
    },
  • Defines the input schema for kb_import tool: object with required 'data' property as string containing JSON.
    {
      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']
      }
    },
  • MCP tool handler: extracts 'data' from arguments, calls KnowledgeManager.importKnowledgeBase, returns success text message.
    case 'kb_import': {
      const { data } = args as any;
      await km.importKnowledgeBase(data);
      return {
        content: [
          {
            type: 'text',
            text: '✅ Knowledge base imported successfully'
          }
        ]
      };
    }
  • Core implementation: Parses JSON data, validates it has version and personal fields, replaces internal KB state, saves to file, with error handling.
    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}`);
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden but provides minimal behavioral context. It states it's an import operation (implies mutation/write) but doesn't disclose critical details: whether this overwrites existing data, merges, requires specific permissions, has side effects, or returns any result. For a mutation tool with zero annotation coverage, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise with a single, clear sentence that front-loads the core purpose. Every word earns its place with no redundancy or fluff, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what happens after import (e.g., success/failure response, side effects), how it interacts with existing data, or error conditions. Given the complexity of importing knowledge bases, more context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the single parameter 'data' fully documented in the schema as 'JSON string of knowledge base data'. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline of 3 for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('import') and resource ('knowledge base'), specifying the source format ('from JSON string'). It distinguishes from obvious siblings like 'kb_export' (export vs import) but doesn't differentiate from other import-like tools like 'kb_initialize' or 'kb_quick_setup' that might also create knowledge bases.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like 'kb_initialize', 'kb_quick_setup', or 'kb_add_custom'. The description implies it's for bulk import from JSON, but doesn't specify prerequisites (e.g., whether a knowledge base must exist first) or when to choose other tools for similar tasks.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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