Skip to main content
Glama

delete_component_folder

Remove a component folder from Storyblok using its folder ID. Permanently deletes the specified folder.

Instructions

Deletes a component folder (component group) by its ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
folder_idYesID of the folder to delete

Implementation Reference

  • The handler function for the 'delete_component_folder' tool. Defined as a server.tool() registration with folder_id as input schema. It calls apiDelete on '/component_groups/{folder_id}' and returns a JSON success response or error.
    // Tool: delete_component_folder
    server.tool(
      'delete_component_folder',
      'Deletes a component folder (component group) by its ID.',
      {
        folder_id: z.string().describe('ID of the folder to delete'),
      },
      async ({ folder_id }) => {
        try {
          await apiDelete(`/component_groups/${folder_id}`);
          return createJsonResponse({ message: `Component folder ${folder_id} deleted successfully.` });
        } catch (error) {
          if (error instanceof APIError) {
            return createErrorResponse(error);
          }
          throw error;
        }
      }
    );
  • The registerComponentsFolder function registers all component folder tools (including delete_component_folder) with the MCP server. This is the entry point for registration.
    export function registerComponentsFolder(server: McpServer): void {
      // Tool: create_component_folder
      server.tool(
        'create_component_folder',
        'Creates a new component folder.',
        {
          name: z.string().describe('Name of the component folder'),
          parent_id: z.number().optional().describe('ID of the parent folder'),
        },
        async ({ name, parent_id }) => {
          try {
            const payload: { component_group: { name: string; parent_id?: number } } = {
              component_group: { name },
            };
            if (parent_id !== undefined) {
              payload.component_group.parent_id = parent_id;
            }
    
            const data = await apiPost('/component_groups/', payload);
            return createJsonResponse(data);
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    
      // Tool: update_component_folder
      server.tool(
        'update_component_folder',
        'Updates an existing component folder (component group).',
        {
          folder_id: z.string().describe('ID of the folder to update'),
          name: z.string().optional().describe('New name for the folder'),
          parent_id: z.number().optional().describe('New parent folder ID'),
          space_id: z.string().optional().describe('Space ID (for future use)'),
        },
        async ({ folder_id, name, parent_id }) => {
          try {
            const payload: { component_group: { name?: string; parent_id?: number } } = {
              component_group: {},
            };
            if (name) {
              payload.component_group.name = name;
            }
            if (parent_id !== undefined) {
              payload.component_group.parent_id = parent_id;
            }
    
            const data = await apiPut(`/component_groups/${folder_id}`, payload);
            return createJsonResponse(data);
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    
      // Tool: delete_component_folder
      server.tool(
        'delete_component_folder',
        'Deletes a component folder (component group) by its ID.',
        {
          folder_id: z.string().describe('ID of the folder to delete'),
        },
        async ({ folder_id }) => {
          try {
            await apiDelete(`/component_groups/${folder_id}`);
            return createJsonResponse({ message: `Component folder ${folder_id} deleted successfully.` });
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    
      // Tool: fetch_component_folders
      server.tool(
        'fetch_component_folders',
        'Retrieves all component folders (non-paginated), with optional filtering.',
        {
          search: z.string().optional().describe('Search query for filtering folders'),
          with_parent: z.number().optional().describe('Filter by parent folder ID'),
        },
        async ({ search, with_parent }) => {
          try {
            const params: Record<string, string> = {};
            if (search) {
              params.search = search;
            }
            if (with_parent !== undefined) {
              params.with_parent = String(with_parent);
            }
    
            const data = await apiGet<{ component_groups: Array<Record<string, unknown>> }>(
              '/component_groups/',
              params
            );
            const groups = data.component_groups || [];
    
            return createJsonResponse({
              component_folders: groups,
              count: groups.length,
            });
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    
      // Tool: retrieve_single_component_folder
      server.tool(
        'retrieve_single_component_folder',
        'Retrieves a single component folder (component group) by its ID.',
        {
          folder_id: z.string().describe('ID of the folder to retrieve'),
        },
        async ({ folder_id }) => {
          try {
            const data = await apiGet<{ component_group?: Record<string, unknown> }>(
              `/component_groups/${folder_id}`
            );
            return createJsonResponse({ component_group: data.component_group || data });
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    }
  • Import of registerComponentsFolder from components-folder.ts, which includes the delete_component_folder tool registration.
    import { registerComponentsFolder } from './components-folder.js';
  • Call to registerComponentsFolder(server) that registers all component folder tools including delete_component_folder.
    registerComponentsFolder(server);
  • The apiDelete helper function used by the delete_component_folder handler to make DELETE requests to the Storyblok Management API.
    export async function apiDelete<T = unknown>(path: string): Promise<T> {
      const url = buildManagementUrl(path);
      const response = await fetch(url, {
        method: 'DELETE',
        headers: getManagementHeaders(),
      });
      return handleResponse<T>(response, url);
    }
Behavior3/5

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

Description states the action 'delete' but does not disclose behavioral traits such as permanence, permissions required, or effects on associated data. With no annotations, the description should provide more context.

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 sentence that directly conveys the action and resource, with no extraneous words. It is efficiently front-loaded.

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

Completeness4/5

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

The tool is simple with one parameter and no output schema. The description is sufficient for its simplicity, though it could mention idempotency or error conditions. Still, it covers the essential purpose.

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?

The single parameter `folder_id` is documented in the schema with description 'ID of the folder to delete.' Schema coverage is 100%, so the description adds no additional meaning beyond the schema, meeting the baseline.

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?

Description explicitly states 'Deletes a component folder (component group) by its ID,' which includes a specific verb (delete) and resource (component folder), clearly distinguishing it from other delete tools.

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

Usage Guidelines3/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, nor any prerequisites or exclusions. The purpose is clear, but additional context (e.g., cascading deletes) would improve selection.

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/hypescale/storyblok-mcp-server'

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