Skip to main content
Glama

update-blog

Modify Shopify blog details such as title, handle, template suffix, and comment policy using the specified blog GID for targeted updates.

Input Schema

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

Implementation Reference

  • Handler function that executes the GraphQL mutation to update blog details using Shopify Admin API.
    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 input schema defining parameters for updating a blog.
    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)
    MCP server registration of the 'update-blog' tool, delegating execution to the imported updateBlog.execute.
    // 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) }] }; } );

Other Tools

Related 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