Skip to main content
Glama

retrieve_single_workflow

Retrieve a specific workflow by its ID from a Storyblok space using the Management API.

Instructions

Retrieves a single workflow by its ID in a Storyblok space via the Management API.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workflow_idYesID of the workflow to retrieve

Implementation Reference

  • The main handler function for the 'retrieve_single_workflow' tool. It accepts a 'workflow_id' parameter (number), calls apiGet with `/workflows/${workflow_id}`, and returns the JSON response.
    // Tool: retrieve_single_workflow
    server.tool(
      'retrieve_single_workflow',
      'Retrieves a single workflow by its ID in a Storyblok space via the Management API.',
      {
        workflow_id: z.number().describe('ID of the workflow to retrieve'),
      },
      async ({ workflow_id }) => {
        try {
          const data = await apiGet(`/workflows/${workflow_id}`);
          return createJsonResponse(data);
        } catch (error) {
          if (error instanceof APIError) {
            return createErrorResponse(error);
          }
          throw error;
        }
      }
    );
  • Zod schema for the tool's input: workflow_id is a z.number().describe('ID of the workflow to retrieve').
    // Tool: retrieve_single_workflow
    server.tool(
      'retrieve_single_workflow',
      'Retrieves a single workflow by its ID in a Storyblok space via the Management API.',
      {
        workflow_id: z.number().describe('ID of the workflow to retrieve'),
      },
      async ({ workflow_id }) => {
        try {
          const data = await apiGet(`/workflows/${workflow_id}`);
          return createJsonResponse(data);
        } catch (error) {
          if (error instanceof APIError) {
            return createErrorResponse(error);
          }
          throw error;
        }
      }
    );
  • The registerWorkflows function registers all workflow tools including 'retrieve_single_workflow' on the MCP server via server.tool().
    export function registerWorkflows(server: McpServer): void {
      // Tool: retrieve_multiple_workflows
      server.tool(
        'retrieve_multiple_workflows',
        "Retrieves all workflows in a Storyblok space via the Management API. Optionally filter by content type (e.g., 'page', 'article', etc.)",
        {
          content_type: z.string().optional().describe('Filter by content type'),
        },
        async ({ content_type }) => {
          try {
            const params: Record<string, string> = {};
            if (content_type !== undefined) params.content_type = content_type;
    
            const data = await apiGet('/workflows', params);
            return createJsonResponse(data);
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    
      // Tool: retrieve_single_workflow
      server.tool(
        'retrieve_single_workflow',
        'Retrieves a single workflow by its ID in a Storyblok space via the Management API.',
        {
          workflow_id: z.number().describe('ID of the workflow to retrieve'),
        },
        async ({ workflow_id }) => {
          try {
            const data = await apiGet(`/workflows/${workflow_id}`);
            return createJsonResponse(data);
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    
      // Tool: create_workflow
      server.tool(
        'create_workflow',
        'Creates a new workflow in a Storyblok space via the Management API.',
        {
          name: z.string().describe('Name of the workflow'),
          content_types: z.array(z.string()).describe('List of content types this workflow applies to'),
        },
        async ({ name, content_types }) => {
          try {
            const payload = {
              workflow: {
                name,
                content_types,
              },
            };
    
            const data = await apiPost('/workflows', payload);
            return createJsonResponse(data);
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    
      // Tool: update_workflow
      server.tool(
        'update_workflow',
        'Updates an existing workflow in a Storyblok space via the Management API.',
        {
          workflow_id: z.number().describe('ID of the workflow to update'),
          name: z.string().describe('New name for the workflow'),
          content_types: z.array(z.string()).describe('New list of content types'),
        },
        async ({ workflow_id, name, content_types }) => {
          try {
            const payload = {
              workflow: {
                name,
                content_types,
              },
            };
    
            const data = await apiPut(`/workflows/${workflow_id}`, payload);
            return createJsonResponse(data);
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    
      // Tool: duplicate_workflow
      server.tool(
        'duplicate_workflow',
        'Duplicates an existing workflow in a Storyblok space via the Management API.',
        {
          workflow_id: z.number().describe('ID of the workflow to duplicate'),
          name: z.string().describe('Name for the duplicated workflow'),
          content_types: z.array(z.string()).describe('Content types for the duplicated workflow'),
        },
        async ({ workflow_id, name, content_types }) => {
          try {
            const payload = {
              workflow: {
                name,
                content_types,
              },
            };
    
            const data = await apiPost(`/workflows/${workflow_id}/duplicate`, payload);
            return createJsonResponse(data);
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    
      // Tool: delete_workflow
      server.tool(
        'delete_workflow',
        'Deletes a workflow by its ID in a Storyblok space via the Management API. The default workflow cannot be deleted.',
        {
          workflow_id: z.number().describe('ID of the workflow to delete'),
        },
        async ({ workflow_id }) => {
          try {
            await apiDelete(`/workflows/${workflow_id}`);
            return {
              content: [
                { type: 'text' as const, text: `Workflow ${workflow_id} has been successfully deleted.` },
              ],
            };
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    }
  • Registration call to registerWorkflows(server) which includes the 'retrieve_single_workflow' tool.
    registerWorkflows(server);
  • The apiGet helper function called by the handler. Makes a GET request to the Storyblok Management API with the given path and params.
    export async function apiGet<T = unknown>(
      path: string,
      params: Record<string, string> = {}
    ): Promise<T> {
      const url = buildUrlWithParams(buildManagementUrl(path), params);
      const response = await fetch(url, {
        method: 'GET',
        headers: getManagementHeaders(),
      });
      return handleResponse<T>(response, url);
    }
Behavior2/5

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

No annotations provided, so description carries full burden. It only states the basic operation without detailing behavioral traits such as authentication requirements, rate limits, or error handling (e.g., behavior when workflow ID not found). Minimal disclosure.

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?

Single sentence, 18 words, front-loaded with purpose. No redundant information. Efficient and clear.

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?

Given the simplicity (1 param, no output schema, no annotations), the description is minimally adequate. However, it lacks usage guidelines and behavioral details, which would improve completeness.

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 coverage is 100% with one parameter clearly described. The description does not add extra meaning beyond the schema, meeting baseline for high coverage but not providing additional context like expected format or constraints.

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 verb 'Retrieves' and the resource 'single workflow', with context of by ID, in a Storyblok space via Management API. It distinguishes from retrieval of multiple workflows or other operations.

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?

No guidance on when to use this tool versus alternatives like retrieve_multiple_workflows or create_workflow. The description does not mention when-not-to-use or provide explicit context for 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