Skip to main content
Glama

create-article

Create and publish articles to Shopify blogs using HTML content, author details, tags, and publication settings.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blogIdYesThe GID of the blog to create the article in (e.g., "gid://shopify/Blog/1234567890")
titleYesThe title of the article
contentYesThe content of the article in HTML format
authorYes
publishedNoWhether to publish the article immediately
tagsNoTags to categorize the article

Implementation Reference

  • The main handler function that executes the tool by sending a GraphQL mutation to create an article in the specified Shopify blog.
    execute: async (args: z.infer<typeof schema>) => {
      if (!createArticle.client) {
        throw new Error("GraphQL client not initialized");
      }
    
      const variables = {
        article: {
          blogId: args.blogId,
          title: args.title,
          body: args.content,
          author: args.author,
          isPublished: args.published,
          tags: args.tags
        }
      };
    
      try {
        const response = await createArticle.client.request<{
          articleCreate: {
            article: {
              id: string;
              title: string;
              handle: string;
              body: string;
              summary: string | null;
              tags: string[];
              author: {
                name: string;
              };
              image: {
                altText: string | null;
                originalSrc: string;
              } | null;
            };
            userErrors: Array<{
              field: string;
              message: string;
            }>;
          };
        }>(CREATE_ARTICLE_MUTATION, variables);
    
        if (response.articleCreate.userErrors.length > 0) {
          throw new Error(
            `Failed to create article: ${response.articleCreate.userErrors
              .map((error) => `${error.field}: ${error.message}`)
              .join(", ")}`
          );
        }
    
        return response.articleCreate.article;
      } catch (error) {
        if (error instanceof Error) {
          throw new Error(`Failed to create article: ${error.message}`);
        }
        throw error;
      }
    }
  • Zod schema defining the input parameters and validation for the create-article tool.
    export const schema = z.object({
      blogId: z.string().min(1).describe("The GID of the blog to create the article in (e.g., \"gid://shopify/Blog/1234567890\")"),
      title: z.string().min(1).describe("The title of the article"),
      content: z.string().min(1).describe("The content of the article in HTML format"),
      author: z.object({
        name: z.string().min(1).describe("The name of the article's author")
      }),
      published: z.boolean().optional().describe("Whether to publish the article immediately"),
      tags: z.array(z.string()).optional().describe("Tags to categorize the article")
    });
  • src/index.ts:297-306 (registration)
    Registers the create-article tool with the MCP server, delegating execution to createArticle.execute.
    server.tool(
      "create-article",
      createArticle.schema.shape,
      async (args: z.infer<typeof createArticle.schema>) => {
        const result = await createArticle.execute(args);
        return {
          content: [{ type: "text", text: JSON.stringify(result) }]
        };
      }
    );
  • GraphQL mutation used by the handler to create the article in Shopify.
    const CREATE_ARTICLE_MUTATION = gql`
      mutation CreateArticle($article: ArticleCreateInput!) {
        articleCreate(article: $article) {
          article {
            id
            title
            handle
            body
            summary
            tags
            author {
              name
            }
            image {
              altText
              originalSrc
            }
          }
          userErrors {
            field
            message
          }
        }
      }
    `;
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