Skip to main content
Glama

create_datasource_entry

Create a new entry in a Storyblok datasource by providing the datasource ID, entry name, and value.

Instructions

Creates a new datasource entry in a specified Storyblok space.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
datasource_idYesID of the datasource
nameYesName of the entry
valueYesValue of the entry

Implementation Reference

  • The handler function for the 'create_datasource_entry' tool. It accepts datasource_id, name, and value, constructs a payload, and POSTs it to the Storyblok API endpoint '/datasource_entries'.
    // Tool: create_datasource_entry
    server.tool(
      'create_datasource_entry',
      'Creates a new datasource entry in a specified Storyblok space.',
      {
        datasource_id: z.number().describe('ID of the datasource'),
        name: z.string().describe('Name of the entry'),
        value: z.string().describe('Value of the entry'),
      },
      async ({ datasource_id, name, value }) => {
        try {
          const payload = {
            datasource_entry: {
              datasource_id,
              name,
              value,
            },
          };
          const data = await apiPost('/datasource_entries', payload);
          return createJsonResponse(data);
        } catch (error) {
          if (error instanceof APIError) {
            return createErrorResponse(error);
          }
          throw error;
        }
      }
    );
  • Zod schema for input validation of the create_datasource_entry tool. Requires datasource_id (number), name (string), and value (string).
    {
      datasource_id: z.number().describe('ID of the datasource'),
      name: z.string().describe('Name of the entry'),
      value: z.string().describe('Value of the entry'),
    },
  • Tool registration: registerDatasourceEntries registers the create_datasource_entry tool via server.tool() within a group of datasource entry tools.
    export function registerDatasourceEntries(server: McpServer): void {
      // Tool: retrieve_multiple_datasource_entries
      server.tool(
        'retrieve_multiple_datasource_entries',
        'Retrieves multiple datasource entries from a specified Storyblok space. Requires datasource_id or datasource_slug.',
        {
          datasource_id: z.number().optional().describe('ID of the datasource'),
          datasource_slug: z.string().optional().describe('Slug of the datasource'),
          dimension: z.string().optional().describe('Dimension filter'),
        },
        async ({ datasource_id, datasource_slug, dimension }) => {
          try {
            if (!datasource_id && !datasource_slug) {
              return {
                isError: true,
                content: [
                  {
                    type: 'text' as const,
                    text: "At least one of 'datasource_id' or 'datasource_slug' must be provided.",
                  },
                ],
              };
            }
    
            const params: Record<string, string> = {};
            if (datasource_id) params.datasource_id = String(datasource_id);
            if (datasource_slug) params.datasource_slug = datasource_slug;
            if (dimension) params.dimension = dimension;
    
            const data = await apiGet('/datasource_entries/', params);
            return createJsonResponse(data);
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    
      // Tool: retrieve_single_datasource_entry
      server.tool(
        'retrieve_single_datasource_entry',
        'Retrieves a single datasource entry via the Storyblok Management API.',
        {
          datasource_entry_id: z.number().describe('ID of the datasource entry'),
        },
        async ({ datasource_entry_id }) => {
          try {
            const data = await apiGet(`/datasource_entries/${datasource_entry_id}`);
            return createJsonResponse(data);
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    
      // Tool: create_datasource_entry
      server.tool(
        'create_datasource_entry',
        'Creates a new datasource entry in a specified Storyblok space.',
        {
          datasource_id: z.number().describe('ID of the datasource'),
          name: z.string().describe('Name of the entry'),
          value: z.string().describe('Value of the entry'),
        },
        async ({ datasource_id, name, value }) => {
          try {
            const payload = {
              datasource_entry: {
                datasource_id,
                name,
                value,
              },
            };
            const data = await apiPost('/datasource_entries', payload);
            return createJsonResponse(data);
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
  • Import of registerDatasourceEntries from datasource-entries module, and its invocation to register the tool with the MCP server.
    import { registerDatasourceEntries } from './datasource-entries.js';
    import { registerBranches } from './pipelines.js';
    import { registerPresets } from './presets.js';
    import { registerReleases } from './releases.js';
    import { registerSchedulingStories } from './scheduling-stories.js';
    import { registerSpace } from './space.js';
    import { registerSpaceRoles } from './space-roles.js';
    import { registerTasks } from './tasks.js';
    import { registerWebhooks } from './webhooks.js';
    import { registerWorkflows } from './workflows.js';
    import { registerWorkflowStages } from './workflow-stage.js';
    import { registerWorkflowStageChanges } from './workflow-stage-changes.js';
    import { registerComponents } from './components.js';
    import { registerComponentsFolder } from './components-folder.js';
    import { registerAssets } from './assets.js';
    import { registerAssetsFolders } from './assets-folder.js';
    import { registerStories } from './stories.js';
    import { registerDiscussions } from './discussions.js';
    import { registerExtensions } from './extensions.js';
    import { registerFieldPlugins } from './field-plugins.js';
    
    /**
     * Registers all tools with the MCP server
     */
    export function registerAllTools(server: McpServer): void {
      // Simple tools
      registerPing(server);
      registerMeta(server);
    
      // Tag management
      registerTags(server);
      registerInternalTags(server);
    
      // Access and authentication
      registerAccessTokens(server);
    
      // Activity tracking
      registerActivities(server);
    
      // Workflow management
      registerApprovals(server);
      registerWorkflows(server);
      registerWorkflowStages(server);
      registerWorkflowStageChanges(server);
    
      // Branch/Pipeline management
      registerBranches(server);
      registerBranchDeployments(server);
    
      // User management
      registerCollaborators(server);
      registerSpaceRoles(server);
    
      // Data sources
      registerDatasources(server);
      registerDatasourceEntries(server);
  • The apiPost helper function used by the create_datasource_entry handler to POST the payload to the Storyblok Management API.
    export async function apiPost<T = unknown>(
      path: string,
      body: unknown
    ): Promise<T> {
      const url = buildManagementUrl(path);
      const response = await fetch(url, {
        method: 'POST',
        headers: getManagementHeaders(),
        body: JSON.stringify(body),
      });
      return handleResponse<T>(response, url);
    }
Behavior2/5

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

With no annotations, the description must convey behavioral traits like mutation, idempotency, or return value, but it only states 'creates' without details on side effects, permissions, or what the tool returns.

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, front-loaded sentence with no filler, conveying the essential purpose efficiently.

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 lack of annotations and output schema, the description should include return value or usage notes but does not, leaving agents underinformed about the tool's behavior.

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%, so the description adds no extra meaning beyond the parameter names and descriptions. Baseline of 3 is appropriate.

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 action (creates) and the resource (datasource entry) within a specific context (Storyblok space), distinguishing it from sibling tools like create_datasource or update_datasource_entry.

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 is provided. The description lacks context such as prerequisites or exclusions, which is needed given the large set of sibling tools.

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