Skip to main content
Glama
martin-1103
by martin-1103

update_folder

Modify folder properties including name, description, and parent location to organize API endpoints and testing workflows within the GASSAPI backend system.

Instructions

Update folder name, description, or parent

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
folderIdYesFolder ID to update
nameNoNew folder name
descriptionNoNew folder description
parentIdNoNew parent folder ID (null to move to root)

Implementation Reference

  • Main handler function executing the update_folder tool. Validates input, initializes services, calls FolderService.updateFolder, and formats the MCP response.
    export async function handleUpdateFolder(args: any): Promise<McpToolResponse> {
      try {
        const { folderId, name, description, parentId } = args;
    
        if (!folderId) {
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({
                  success: false,
                  error: 'Folder ID is required'
                }, null, 2)
              }
            ]
          };
        }
    
        const instances = await getInstances();
    
        // Create folder service
        const folderService = new FolderService(
          instances.backendClient.getBaseUrl(),
          instances.backendClient.getToken()
        );
    
        // Update folder
        const updateRequest: UpdateFolderRequest = {
          folderId,
          name: name?.trim(),
          description: description?.trim(),
          parentId
        };
    
        const response = await folderService.updateFolder(updateRequest);
    
        if (!response.success) {
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({
                  success: false,
                  error: response.error || 'Failed to update folder'
                }, null, 2)
              }
            ]
          };
        }
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                success: true,
                data: response.data,
                message: 'Folder updated successfully'
              }, null, 2)
            }
          ]
        };
    
      } catch (error: any) {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                success: false,
                error: error.message || 'Unknown error occurred while updating folder'
              }, null, 2)
            }
          ]
        };
      }
    }
  • MCP tool definition for update_folder, including input schema, description, and handler reference.
    export const updateFolderTool: McpTool = {
      name: 'update_folder',
      description: 'Update folder name, description, or parent',
      inputSchema: {
        type: 'object',
        properties: {
          folderId: {
            type: 'string',
            description: 'Folder ID to update'
          },
          name: {
            type: 'string',
            description: 'New folder name'
          },
          description: {
            type: 'string',
            description: 'New folder description'
          },
          parentId: {
            type: 'string',
            description: 'New parent folder ID (null to move to root)'
          }
        },
        required: ['folderId']
      },
      handler: handleUpdateFolder
    };
  • Registration of the update_folder handler in the main createFolderToolHandlers factory function, used by the MCP server.
    'update_folder': async (args: any) => {
      const { handleUpdateFolder } = await import('./folders/handlers/folderHandlers.js');
      return handleUpdateFolder(args);
    },
  • TypeScript interface defining the UpdateFolderRequest used for input validation and typing.
    export interface UpdateFolderRequest {
      folderId: string;
      name?: string;
      description?: string;
      parentId?: string;
    }
  • Helper service method in FolderService that performs the actual HTTP PUT request to the backend to update the folder.
    async updateFolder(request: UpdateFolderRequest): Promise<UpdateFolderResponse> {
      try {
        // Validate request
        const validation = this.validateUpdateRequest(request);
        if (!validation.valid) {
          return {
            success: false,
            error: 'Validation failed',
            details: validation.errors
          };
        }
    
        const url = `${this.baseUrl}/?act=folder_update&id=${request.folderId}`;
        const updateData: any = {};
    
        if (request.name !== undefined) {
          updateData.name = request.name.trim();
        }
        if (request.description !== undefined) {
          updateData.description = request.description?.trim() || null;
        }
        if (request.parentId !== undefined) {
          updateData.parent_id = request.parentId;
        }
    
        const response = await this.httpClient.put(url, updateData);
    
        if (response.success && response.data) {
          return {
            success: true,
            data: response.data,
            message: 'Folder updated successfully'
          };
        }
    
        return {
          success: false,
          error: response.error || 'Failed to update folder'
        };
    
      } catch (error) {
        return {
          success: false,
          error: ErrorUtils.extractMessage(error)
        };
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool updates folder attributes, implying mutation, but doesn't disclose behavioral traits like permission requirements, whether updates are reversible, rate limits, or what happens to child items. For a mutation tool with zero annotation coverage, 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 extremely concise—a single sentence with no wasted words. It front-loads the core action ('update folder') and efficiently lists the modifiable attributes. Every element earns its place, making it easy for an agent 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?

Given the tool's complexity (mutation with 4 parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like error conditions, response format, or side effects. For a folder update operation, more context is needed to guide safe and effective usage.

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 four parameters (folderId, name, description, parentId) with clear descriptions. The description adds minimal value by listing updatable fields but doesn't provide additional semantics beyond what's in the schema, such as format constraints or examples. Baseline 3 is appropriate when schema does the heavy lifting.

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 verb 'update' and resource 'folder', specifying what fields can be modified (name, description, parent). It distinguishes from sibling tools like 'create_folder' and 'delete_folder' by focusing on modification rather than creation or deletion. However, it doesn't explicitly differentiate from other update tools like 'update_endpoint' or 'update_environment_variables' beyond the resource type.

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. It doesn't mention prerequisites (e.g., needing folder ID), exclusions (e.g., what cannot be updated), or comparisons with similar tools like 'update_endpoint'. The agent must infer usage from the tool name and parameters 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/martin-1103/mcp2'

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