Skip to main content
Glama
angrysky56

Advanced Reasoning MCP Server

create_memory_library

Create named memory libraries to organize knowledge storage for different projects, domains, or contexts within the Advanced Reasoning MCP Server.

Instructions

Create a new named memory library for organized knowledge storage.

Enables you to create separate, named memory libraries for different projects, domains, or contexts. Library names must contain only letters, numbers, underscores, and hyphens.

Parameters:

  • library_name: Name for the new library (required)

Returns success status and message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
library_nameYesName for the new memory library

Implementation Reference

  • Core handler implementing the logic to create a new memory library: validates name format, checks existence, saves current state if any, clears memory, sets new library name, and persists empty library file.
    async createLibrary(libraryName: string): Promise<{ success: boolean; message: string }> {
      try {
        // Validate library name (alphanumeric, underscore, hyphen only)
        if (!/^[a-zA-Z0-9_-]+$/.test(libraryName)) {
          return { success: false, message: 'Library name must contain only letters, numbers, underscores, and hyphens' };
        }
    
        const fileName = `${libraryName}.json`;
        const filePath = path.join(this.memoryDataPath, fileName);
    
        // Check if library already exists
        try {
          await fs.access(filePath);
          return { success: false, message: `Library "${libraryName}" already exists` };
        } catch {
          // Library doesn't exist, which is what we want
        }
    
        // Save current state if we have data
        if (this.nodes.size > 0 || this.sessions.size > 0) {
          await this.saveToFile();
        }
    
        // Clear current memory and create new library
        this.nodes.clear();
        this.sessions.clear();
        this.rebuildSearchIndex();
        this.currentLibraryName = libraryName;
    
        // Save empty library
        await this.saveToFile();
    
        return { success: true, message: `Created library: ${libraryName}` };
      } catch (error) {
        return { success: false, message: `Failed to create library: ${error}` };
      }
    }
  • MCP tool handler in AdvancedReasoningServer class that invokes CognitiveMemory.createLibrary and formats the JSON response for the protocol.
    public async createLibrary(libraryName: string): Promise<{ content: Array<{ type: string; text: string }>; isError?: boolean }> {
      try {
        const result = await this.memory.createLibrary(libraryName);
    
        return {
          content: [{
            type: "text",
            text: JSON.stringify({
              libraryName,
              success: result.success,
              message: result.message,
              currentLibrary: this.memory.getCurrentLibraryName()
            }, null, 2)
          }],
          isError: !result.success
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: JSON.stringify({
              error: error instanceof Error ? error.message : String(error),
              status: 'failed'
            }, null, 2)
          }],
          isError: true
        };
      }
    }
  • Input schema defining the required 'library_name' parameter as a string.
    inputSchema: {
      type: "object",
      properties: {
        library_name: { type: "string", description: "Name for the new memory library" }
      },
      required: ["library_name"]
    }
  • src/index.ts:1420-1423 (registration)
    Tool dispatch case in the CallToolRequestHandler switch statement that extracts arguments and calls the handler.
    case "create_memory_library":
      const { library_name: createLibName } = args as { library_name: string };
      return await reasoningServer.createLibrary(createLibName);
  • src/index.ts:1236-1254 (registration)
    Tool object definition including name, description, and schema, used for registration in ListToolsRequestHandler.
    const CREATE_LIBRARY_TOOL: Tool = {
      name: "create_memory_library",
      description: `Create a new named memory library for organized knowledge storage.
    
    Enables you to create separate, named memory libraries for different projects, domains, or contexts.
    Library names must contain only letters, numbers, underscores, and hyphens.
    
    Parameters:
    - library_name: Name for the new library (required)
    
    Returns success status and message.`,
      inputSchema: {
        type: "object",
        properties: {
          library_name: { type: "string", description: "Name for the new memory library" }
        },
        required: ["library_name"]
      }
    };
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It clearly indicates this is a creation/mutation operation and specifies naming constraints (letters, numbers, underscores, hyphens), which is useful behavioral context. However, it doesn't mention potential error conditions (e.g., duplicate names), permission requirements, or whether the operation is idempotent/reversible.

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 well-structured and appropriately sized with three focused paragraphs: purpose statement, usage context, and parameter/return information. Every sentence adds value with no redundancy or wasted words. The information is front-loaded with the core purpose stated first.

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

Completeness3/5

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

For a creation tool with no annotations and no output schema, the description provides adequate but incomplete context. It covers the basic operation, naming constraints, and return indication, but lacks details about error conditions, response format, or integration with sibling tools. The absence of output schema means the description should ideally provide more detail about what 'success status and message' entails.

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%, so the schema already fully documents the single parameter. The description repeats the parameter name and requirement but adds minimal value beyond what's in the schema. The naming constraint information is useful but doesn't significantly enhance understanding of the parameter's semantics beyond the schema's basic description.

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

Purpose5/5

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

The description clearly states the tool's purpose with specific verb ('create') and resource ('new named memory library'), distinguishing it from sibling tools like 'list_memory_libraries' and 'switch_memory_library' which perform different operations on the same resource. It also specifies the function is for 'organized knowledge storage' and mentions different use cases (projects, domains, contexts).

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

Usage Guidelines4/5

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

The description provides clear context about when to use this tool ('for different projects, domains, or contexts') and implicitly distinguishes it from sibling tools by focusing on creation rather than listing, querying, or switching libraries. However, it doesn't explicitly state when NOT to use it or name specific alternatives like 'list_memory_libraries' for checking existing libraries first.

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/angrysky56/advanced-reasoning-mcp'

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