Skip to main content
Glama

update-blog

Modify blog settings in Shopify stores by updating the title, URL handle, template suffix, or comment policy for existing blogs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blogIdYesThe GID of the blog to update (e.g., "gid://shopify/Blog/1234567890")
titleNo
handleNo
templateSuffixNo
commentPolicyNo

Implementation Reference

  • The main tool object defining the 'update-blog' tool, including its execute handler which performs a GraphQL mutation to update blog details using Shopify Admin API.
    const updateBlog = {
      name: "update-blog",
      description: "Updates a blog's details including title, handle, template suffix, and comment policy",
      schema: UpdateBlogInputSchema,
    
      initialize(client: GraphQLClient) {
        shopifyClient = client;
      },
    
      execute: async (input: UpdateBlogInput) => {
        try {
          const { blogId, ...updateData } = input;
    
          const mutation = gql`
            mutation UpdateBlog($id: ID!, $blog: BlogUpdateInput!) {
              blogUpdate(id: $id, blog: $blog) {
                blog {
                  id
                  title
                  handle
                  templateSuffix
                  commentPolicy
                }
                userErrors {
                  field
                  message
                }
              }
            }
          `;
    
          const variables = {
            id: blogId,
            blog: updateData
          };
    
          const data = await shopifyClient.request(mutation, variables) as {
            blogUpdate: {
              blog: {
                id: string;
                title: string;
                handle: string;
                templateSuffix: string | null;
                commentPolicy: string;
              };
              userErrors: Array<{
                field: string;
                message: string;
              }>;
            };
          };
    
          if (data.blogUpdate.userErrors.length > 0) {
            throw new Error(
              `Failed to update blog: ${data.blogUpdate.userErrors
                .map((error) => error.message)
                .join(", ")}`
            );
          }
    
          return {
            blog: data.blogUpdate.blog
          };
        } catch (error) {
          console.error("Error updating blog:", error);
          throw new Error(
            `Failed to update blog: ${
              error instanceof Error ? error.message : String(error)
            }`
          );
        }
      }
    };
  • Zod schema defining the input parameters for the update-blog tool.
    // Input schema for updateBlog
    const UpdateBlogInputSchema = z.object({
      blogId: z.string().min(1).describe("The GID of the blog to update (e.g., \"gid://shopify/Blog/1234567890\")"),
      title: z.string().optional().describe("The new title for the blog"),
      handle: z.string().optional().describe("The URL-friendly handle for the blog"),
      templateSuffix: z.string().optional().describe("The template suffix for the blog"),
      commentPolicy: z.enum(["MODERATED", "CLOSED"]).optional().describe("The comment policy for the blog")
    });
  • src/index.ts:208-224 (registration)
    Registration of the 'update-blog' tool with the MCP server, including inline schema and delegation to the imported tool's execute method.
    // Add the updateBlog tool
    server.tool(
      "update-blog",
      {
        blogId: z.string().min(1).describe("The GID of the blog to update (e.g., \"gid://shopify/Blog/1234567890\")"),
        title: z.string().optional(),
        handle: z.string().optional(),
        templateSuffix: z.string().optional(),
        commentPolicy: z.enum(["MODERATED", "CLOSED"]).optional()
      },
      async (args) => {
        const result = await updateBlog.execute(args);
        return {
          content: [{ type: "text", text: JSON.stringify(result) }]
        };
      }
    );
Behavior1/5

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

Tool has no description.

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

Conciseness1/5

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

Tool has no description.

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

Completeness1/5

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

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose1/5

Does the description clearly state what the tool does and how it differs from similar tools?

Tool has no description.

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

Usage Guidelines1/5

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

Tool has no description.

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/luckyfarnon/Shopify-MCP'

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