Skip to main content
Glama

manage_folder

Create, rename, move, or delete folders in Obsidian vaults to organize your knowledge base structure.

Instructions

Create, rename, move, or delete a folder in the Obsidian vault

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationYesThe operation to perform: create, rename, move, or delete
pathYesPath to the folder within the vault
newPathNoNew path for the folder (required for rename and move operations)

Implementation Reference

  • src/index.ts:1196-1217 (registration)
    Registration of the 'manage_folder' tool in the listTools handler, including name, description, and input schema definition.
      name: 'manage_folder',
      description: 'Create, rename, move, or delete a folder in the Obsidian vault',
      inputSchema: {
        type: 'object',
        properties: {
          operation: {
            type: 'string',
            description: 'The operation to perform: create, rename, move, or delete',
            enum: ['create', 'rename', 'move', 'delete']
          },
          path: {
            type: 'string',
            description: 'Path to the folder within the vault'
          },
          newPath: {
            type: 'string',
            description: 'New path for the folder (required for rename and move operations)'
          }
        },
        required: ['operation', 'path'],
      },
    },
  • The main handler function that executes the manage_folder tool logic. It handles input validation and dispatches to specific folder operations: create, rename, move, or delete.
    private async handleManageFolder(args: any) {
      if (!args?.operation || !args?.path) {
        throw new Error('Operation and path are required');
      }
      
      const operation = args.operation;
      const folderPath = args.path;
      const newPath = args.newPath;
      
      switch (operation) {
        case 'create':
          await this.createFolder(folderPath);
          return {
            content: [
              {
                type: 'text',
                text: `Folder created successfully at ${folderPath}`,
              },
            ],
          };
        
        case 'rename':
          if (!newPath) {
            throw new Error('New path is required for rename operation');
          }
          await this.renameFolder(folderPath, newPath);
          return {
            content: [
              {
                type: 'text',
                text: `Folder renamed from ${folderPath} to ${newPath}`,
              },
            ],
          };
        
        case 'move':
          if (!newPath) {
            throw new Error('New path is required for move operation');
          }
          await this.moveFolder(folderPath, newPath);
          return {
            content: [
              {
                type: 'text',
                text: `Folder moved from ${folderPath} to ${newPath}`,
              },
            ],
          };
        
        case 'delete':
          await this.deleteFolder(folderPath);
          return {
            content: [
              {
                type: 'text',
                text: `Folder deleted successfully: ${folderPath}`,
              },
            ],
          };
        
        default:
          throw new Error(`Unknown folder operation: ${operation}`);
      }
    }
  • Tool call dispatcher registration where the manage_folder handler is invoked via switch case.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
      try {
        switch (request.params.name) {
          case 'list_notes':
            return await this.handleListNotes(request.params.arguments);
          case 'read_note':
            return await this.handleReadNote(request.params.arguments);
          case 'create_note':
            return await this.handleCreateNote(request.params.arguments);
          case 'search_vault':
            return await this.handleSearchVault(request.params.arguments);
          case 'delete_note':
            return await this.handleDeleteNote(request.params.arguments);
          case 'move_note':
            return await this.handleMoveNote(request.params.arguments);
          case 'manage_folder':
            return await this.handleManageFolder(request.params.arguments);
          case 'update_note':
            return await this.handleUpdateNote(request.params.arguments);
          case 'read_multiple_notes':
            return await this.handleReadMultipleNotes(request.params.arguments);
          case 'auto_backlink_vault':
            return await this.handleAutoBacklinkVault(request.params.arguments);
          case 'notes_insight':
            return await this.handleNotesInsight(request.params.arguments);
          default:
            throw new McpError(
              ErrorCode.MethodNotFound,
              `Unknown tool: ${request.params.name}`
            );
        }
      } catch (error) {
        console.error(`Error executing tool ${request.params.name}:`, error);
        throw new McpError(
          ErrorCode.InternalError,
          `${error instanceof Error ? error.message : String(error)}`
        );
      }
    });
  • Helper function to create a folder using Obsidian API or filesystem fallback.
    private async createFolder(folderPath: string): Promise<void> {
      try {
        // First try using the Obsidian API
        await this.api.post(`/folders/${encodeURIComponent(folderPath)}`);
      } catch (error) {
        console.warn('API request failed, falling back to file system:', error);
        
        // Fallback to file system if API fails
        const fullPath = path.join(VAULT_PATH, folderPath);
        
        if (!fs.existsSync(fullPath)) {
          fs.mkdirSync(fullPath, { recursive: true });
        }
      }
    }
  • Helper function to delete a folder recursively using API or filesystem.
    private async deleteFolder(folderPath: string): Promise<void> {
      try {
        // First try using the Obsidian API
        await this.api.delete(`/folders/${encodeURIComponent(folderPath)}`);
      } catch (error) {
        console.warn('API request failed, falling back to file system:', error);
        
        // Fallback to file system if API fails
        const fullPath = path.join(VAULT_PATH, folderPath);
        
        if (!fs.existsSync(fullPath)) {
          throw new Error(`Folder not found: ${folderPath}`);
        }
        
        // Recursively delete the folder and its contents
        this.deleteFolderRecursive(fullPath);
      }
    }
Behavior2/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 mentions operations but lacks details on permissions, side effects (e.g., what happens to contents when deleting), error handling, or rate limits. For a tool with multiple mutation operations, this is a significant gap in transparency.

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 a single, efficient sentence that front-loads all key operations (create, rename, move, delete) and the resource (folder in Obsidian vault). There is no wasted verbiage, making it highly concise and well-structured for quick understanding.

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?

Given the complexity of multiple mutation operations, no annotations, and no output schema, the description is incomplete. It does not address behavioral aspects like safety, response formats, or error conditions, which are critical for an agent to use the tool correctly in a vault environment.

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 documents all parameters thoroughly. The description adds no additional meaning beyond what the schema provides, such as examples or edge cases. Baseline 3 is appropriate as the schema does the heavy lifting, but the description does not compensate with extra context.

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 specific actions (create, rename, move, delete) and the resource (folder in Obsidian vault), distinguishing it from sibling tools like create_note or move_note that operate on notes rather than folders. It precisely defines the tool's scope without being vague or tautological.

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?

The description provides no guidance on when to use this tool versus alternatives, such as create_note for notes or other folder-related operations. It lists operations but does not specify contexts, prerequisites, or exclusions, leaving the agent to infer usage from the operation names alone.

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/newtype-01/obsidian-mcp'

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