Skip to main content
Glama

get_story_versions

Retrieve revisions of a story by its ID, optionally filtering by version, release, or pagination. Includes content if requested.

Instructions

Retrieves versions (revisions) of stories.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
by_story_idYesStory ID to get versions for
version_idNoSpecific version ID to retrieve
by_release_idNoFilter by release ID
pageNoPage number
per_pageNoItems per page (max 100)
show_contentNoInclude content in response

Implementation Reference

  • The handler function for the 'get_story_versions' tool. It builds request params (by_story_id, version_id, by_release_id, page, per_page, show_content), calls apiGet('/story_versions', params), and returns the response with versions array and pagination info.
      async ({ by_story_id, version_id, by_release_id, page, per_page, show_content }) => {
        try {
          const params: Record<string, string> = {
            by_story_id: String(by_story_id),
            page: String(page),
            per_page: String(Math.min(per_page, 100)),
          };
    
          if (version_id !== undefined) {
            params.version_id = String(version_id);
          }
          if (by_release_id !== undefined) {
            params.by_release_id = String(by_release_id);
          }
          if (show_content) {
            params.show_content = '1';
          }
    
          const data = await apiGet<{ story_versions: Array<Record<string, unknown>>; total?: number }>(
            '/story_versions',
            params
          );
    
          return createJsonResponse({
            versions: data.story_versions || [],
            page,
            per_page: Math.min(per_page, 100),
            total: data.total ?? null,
          });
        } catch (error) {
          if (error instanceof APIError) {
            return createErrorResponse(error);
          }
          throw error;
        }
      }
    );
  • Zod schema for input validation of the 'get_story_versions' tool. Defines parameters: by_story_id (required number), version_id (optional number), by_release_id (optional number), page (optional number, default 1), per_page (optional number, default 25, max 100), show_content (optional boolean, default false).
    {
      by_story_id: z.number().describe('Story ID to get versions for'),
      version_id: z.number().optional().describe('Specific version ID to retrieve'),
      by_release_id: z.number().optional().describe('Filter by release ID'),
      page: z.number().optional().default(1).describe('Page number'),
      per_page: z.number().optional().default(25).describe('Items per page (max 100)'),
      show_content: z.boolean().optional().default(false).describe('Include content in response'),
    },
  • Registration of the 'get_story_versions' tool via server.tool(). The tool is registered with name, description, schema, and handler inside the registerStories() function.
    server.tool(
      'get_story_versions',
      'Retrieves versions (revisions) of stories.',
      {
        by_story_id: z.number().describe('Story ID to get versions for'),
        version_id: z.number().optional().describe('Specific version ID to retrieve'),
        by_release_id: z.number().optional().describe('Filter by release ID'),
        page: z.number().optional().default(1).describe('Page number'),
        per_page: z.number().optional().default(25).describe('Items per page (max 100)'),
        show_content: z.boolean().optional().default(false).describe('Include content in response'),
      },
      async ({ by_story_id, version_id, by_release_id, page, per_page, show_content }) => {
        try {
          const params: Record<string, string> = {
            by_story_id: String(by_story_id),
            page: String(page),
            per_page: String(Math.min(per_page, 100)),
          };
    
          if (version_id !== undefined) {
            params.version_id = String(version_id);
          }
          if (by_release_id !== undefined) {
            params.by_release_id = String(by_release_id);
          }
          if (show_content) {
            params.show_content = '1';
          }
    
          const data = await apiGet<{ story_versions: Array<Record<string, unknown>>; total?: number }>(
            '/story_versions',
            params
          );
    
          return createJsonResponse({
            versions: data.story_versions || [],
            page,
            per_page: Math.min(per_page, 100),
            total: data.total ?? null,
          });
        } catch (error) {
          if (error instanceof APIError) {
            return createErrorResponse(error);
          }
          throw error;
        }
      }
    );
  • The registerStories(server) call in registerAllTools() which triggers registration of all story tools including 'get_story_versions'.
    registerStories(server);
  • The apiGet helper function used by the handler to make GET requests to the Storyblok Management API. It builds the URL with query params and returns the parsed response.
    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?

The description implies a read-only operation but provides no additional behavioral details such as authentication requirements, rate limits, or pagination behavior. With no annotations, the description fails to disclose important traits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence that is concise. However, it could be slightly longer to include key usage context without becoming verbose.

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 6 parameters, no output schema, and no annotations, the description is too thin. It omits critical information about pagination (page/per_page), filtering (version_id vs by_release_id), and the effect of show_content.

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?

All parameters have descriptions in the schema (100% coverage), so the description adds no extra meaning. The description does not explain parameter relationships or usage beyond what the schema provides.

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 it 'retrieves versions (revisions) of stories,' which directly matches the tool name and resource. However, it does not differentiate from sibling tools like compare_story_versions or restore_story.

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 compare_story_versions or retrieve_single_component_version. There is no mention of prerequisites or contexts where this tool is appropriate.

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