Skip to main content
Glama
saralegui-solutions

MCP Self-Learning Server

import_knowledge

Import external knowledge sources into the MCP Self-Learning Server to enhance its autonomous learning capabilities through pattern recognition and machine learning.

Instructions

Import external knowledge

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYes
mergeNo

Implementation Reference

  • The core handler function for the 'import_knowledge' tool. It reads a JSON file from the 'source' path, parses the knowledge data, and either merges patterns into the learning engine (if merge=true) or replaces the existing patterns entirely. Returns success status and import stats.
    async handleImportKnowledge(args) {
      const { source, merge = true } = args;
      
      try {
        const content = await fs.readFile(source, 'utf-8');
        const knowledge = JSON.parse(content);
        
        if (merge) {
          await this.knowledgeSync.mergeKnowledge();
        } else {
          // Replace existing knowledge
          this.learningEngine.patterns.clear();
          for (const [key, pattern] of knowledge.patterns) {
            this.learningEngine.patterns.set(key, pattern);
          }
        }
        
        return {
          success: true,
          imported: knowledge.patterns.length,
          merged: merge
        };
      } catch (error) {
        throw new Error(`Failed to import knowledge: ${error.message}`);
      }
    }
  • MCP tool registration in the ListTools response, including the tool name, description, and input schema specifying 'source' (required string path to knowledge file) and optional 'merge' boolean.
    {
      name: 'import_knowledge',
      description: 'Import external knowledge',
      inputSchema: {
        type: 'object',
        properties: {
          source: { type: 'string' },
          merge: { type: 'boolean', default: true }
        },
        required: ['source']
      }
    },
  • Input schema definition for the import_knowledge tool, validating the arguments: required 'source' string and optional 'merge' boolean (defaults to true).
    inputSchema: {
      type: 'object',
      properties: {
        source: { type: 'string' },
        merge: { type: 'boolean', default: true }
      },
      required: ['source']
    }
Behavior1/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Import external knowledge' implies a write/mutation operation but reveals nothing about permissions needed, whether the operation is idempotent, what happens on failure, rate limits, or what the tool actually does with imported knowledge. The description provides no behavioral context beyond the basic action implied by the name.

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?

The description is maximally concise at just two words. While this represents under-specification rather than ideal conciseness, from a pure structural perspective, every word earns its place - 'import' specifies the action and 'external knowledge' specifies the resource. There's no wasted language or unnecessary elaboration.

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

Completeness1/5

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

For a tool with 2 parameters, 0% schema coverage, no annotations, and no output schema, the description is completely inadequate. A mutation tool like 'import' requires information about what it does, what parameters mean, what permissions are needed, and what happens to existing knowledge. The current description provides none of this essential context for safe and effective tool invocation.

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

Parameters1/5

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

With 0% schema description coverage and 2 parameters (source, merge), the description provides no information about what these parameters mean. 'Import external knowledge' doesn't explain what 'source' should contain (URL, file path, text content?), what 'merge' controls, or how these parameters affect the import operation. The description fails to compensate for the complete lack of schema documentation.

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

Purpose2/5

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

The description 'Import external knowledge' is a tautology that essentially restates the tool name 'import_knowledge'. While it indicates the general action (import) and resource (knowledge), it lacks specificity about what type of knowledge, from what sources, or into what system. It doesn't distinguish this tool from its sibling 'export_knowledge' beyond the direction of transfer.

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

Usage Guidelines1/5

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

The description provides no guidance on when to use this tool versus alternatives. There's no mention of prerequisites, appropriate contexts, or when not to use it. With sibling tools like 'analyze_pattern', 'get_insights', and 'trigger_learning' that might interact with knowledge, the absence of usage guidance leaves the agent guessing about when this import operation is appropriate.

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/saralegui-solutions/mcp-self-learning-server'

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