Skip to main content
Glama

update_tag

Update the name of an existing tag in a Storyblok space by providing its ID and new name.

Instructions

Updates the name of an existing tag in a Storyblok space.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tag_idYesID of the tag to update
new_nameYesNew name for the tag

Implementation Reference

  • The 'update_tag' tool handler: defines schema (tag_id, new_name), builds a PUT request to /tags/{tag_id}, and returns success/failure responses.
    // Tool: update_tag
    server.tool(
      'update_tag',
      'Updates the name of an existing tag in a Storyblok space.',
      {
        tag_id: z.string().describe('ID of the tag to update'),
        new_name: z.string().describe('New name for the tag'),
      },
      async ({ tag_id, new_name }) => {
        try {
          const payload = {
            id: tag_id,
            tag: { name: new_name },
          };
          const url = buildManagementUrl(`/tags/${tag_id}`);
          const response = await fetch(url, {
            method: 'PUT',
            headers: getManagementHeaders(),
            body: JSON.stringify(payload),
          });
    
          if (response.status === 204) {
            return {
              content: [{ type: 'text' as const, text: 'Tag updated successfully.' }],
            };
          } else {
            return {
              isError: true,
              content: [
                {
                  type: 'text' as const,
                  text: `Failed to update tag. Status code: ${response.status}`,
                },
              ],
            };
          }
        } catch (error) {
          if (error instanceof APIError) {
            return createErrorResponse(error);
          }
          throw error;
        }
      }
    );
  • Registration call: registerTags(server) is invoked in registerAllTools, which registers all 5 tag tools including update_tag.
    registerTags(server);
  • The registerTags function that wraps all 5 tag tool registrations (including update_tag) with the MCP server.
    export function registerTags(server: McpServer): void {
      // Tool: retrieve_multiple_tags
      server.tool(
        'retrieve_multiple_tags',
        'Retrieves multiple tags from a specified Storyblok space using the Management API.',
        {
          search: z.string().optional().describe('Search query for filtering tags'),
        },
        async ({ search }) => {
          try {
            const params: Record<string, string> = {};
            if (search) {
              params.search = search;
            }
            const data = await apiGet('/tags/', params);
            return createJsonResponse(data);
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    
      // Tool: create_tag
      server.tool(
        'create_tag',
        'Creates a new tag in a Storyblok space via the Management API.',
        {
          name: z.string().describe('Name of the tag'),
          story_id: z.number().optional().describe('Optional story ID to associate with the tag'),
        },
        async ({ name, story_id }) => {
          try {
            const payload: { tag: { name: string; story_id?: number } } = {
              tag: { name },
            };
            if (story_id !== undefined) {
              payload.tag.story_id = story_id;
            }
            const data = await apiPost('/tags/', payload);
            return createJsonResponse(data);
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    
      // Tool: update_tag
      server.tool(
        'update_tag',
        'Updates the name of an existing tag in a Storyblok space.',
        {
          tag_id: z.string().describe('ID of the tag to update'),
          new_name: z.string().describe('New name for the tag'),
        },
        async ({ tag_id, new_name }) => {
          try {
            const payload = {
              id: tag_id,
              tag: { name: new_name },
            };
            const url = buildManagementUrl(`/tags/${tag_id}`);
            const response = await fetch(url, {
              method: 'PUT',
              headers: getManagementHeaders(),
              body: JSON.stringify(payload),
            });
    
            if (response.status === 204) {
              return {
                content: [{ type: 'text' as const, text: 'Tag updated successfully.' }],
              };
            } else {
              return {
                isError: true,
                content: [
                  {
                    type: 'text' as const,
                    text: `Failed to update tag. Status code: ${response.status}`,
                  },
                ],
              };
            }
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    
      // Tool: delete_tag
      server.tool(
        'delete_tag',
        'Deletes a tag from Storyblok.',
        {
          id: z.string().describe('ID of the tag to delete'),
        },
        async ({ id }) => {
          try {
            const url = buildManagementUrl(`/tags/${id}`);
            const response = await fetch(url, {
              method: 'DELETE',
              headers: getManagementHeaders(),
            });
    
            if (response.status === 204) {
              return {
                content: [{ type: 'text' as const, text: 'Tag deleted successfully.' }],
              };
            } else {
              return {
                isError: true,
                content: [
                  {
                    type: 'text' as const,
                    text: `Failed to delete tag. Status code: ${response.status}`,
                  },
                ],
              };
            }
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    
      // Tool: tag_bulk_association
      server.tool(
        'tag_bulk_association',
        'Adds tags to multiple stories in a Storyblok space.',
        {
          stories: z
            .array(z.record(z.unknown()))
            .describe('Array of story objects with tag data'),
        },
        async ({ stories }) => {
          try {
            const payload = {
              tags: {
                stories,
              },
            };
            const data = await apiPost('/tags/bulk_association', payload);
            return createJsonResponse(data);
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    }
Behavior2/5

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

No annotations provided. Description indicates mutation but lacks details on side effects, authorization, or reversibility. For a mutation tool, more behavioral context is needed.

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 with 10 words, no unnecessary information. Highly concise and front-loaded.

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?

No output schema, no annotations. Description does not explain return value, error conditions, or prerequisites like tag existence. Incomplete for a mutation tool.

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 covers both parameters with descriptions. Description adds 'existing tag' context but does not explain parameter semantics beyond the schema. Baseline 3 is appropriate given 100% schema coverage.

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?

Clearly states the verb ('Updates'), resource ('name of an existing tag'), and context ('in a Storyblok space'). Distinguishes from sibling tools like create_tag and delete_tag.

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

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Implies usage for updating an existing tag's name, but does not explicitly exclude other contexts or mention alternatives. Still, the purpose is clear enough for an agent to infer when to use.

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