Skip to main content
Glama
kishimoto-banana

Shopify Python MCP Server

create_product

Add new products to your Shopify store by specifying details like title, description, vendor, type, tags, status, variants, options, and images using the tool.

Instructions

新しい商品を作成する

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
body_htmlNo商品の説明(HTML形式)
imagesNo画像
optionsNoオプション
product_typeNo商品タイプ
statusNoステータスactive
tagsNoタグ(カンマ区切り)
titleYes商品名
variantsNoバリエーション
vendorNoベンダー名

Implementation Reference

  • The handler function that executes the create_product tool. It validates input, creates a Shopify Product object, sets fields from arguments (title, description, vendor, type, tags, status, options, variants, images), saves the product via Shopify API, and returns a JSON response with success status and new product ID.
    async def handle_create_product(arguments: dict) -> list[types.TextContent]:
        """新しい商品を作成する"""
        # 必須パラメータのチェック
        title = arguments.get("title")
        if not title:
            raise ValueError("title is required")
    
        # 商品オブジェクトの作成
        product = shopify.Product()
        product.title = title
    
        # オプションパラメータの設定
        if "body_html" in arguments:
            product.body_html = arguments["body_html"]
        if "vendor" in arguments:
            product.vendor = arguments["vendor"]
        if "product_type" in arguments:
            product.product_type = arguments["product_type"]
        if "tags" in arguments:
            product.tags = arguments["tags"]
        if "status" in arguments:
            product.status = arguments["status"]
    
        # オプションの設定
        if "options" in arguments and arguments["options"]:
            options = []
            for option_data in arguments["options"]:
                option = shopify.Option()
                option.name = option_data["name"]
                option.position = option_data["position"]
                option.values = option_data["values"]
                options.append(option)
            product.options = options
    
        # バリエーションの設定
        if "variants" in arguments and arguments["variants"]:
            variants = []
            for variant_data in arguments["variants"]:
                variant = shopify.Variant()
                if "price" in variant_data:
                    variant.price = variant_data["price"]
                if "sku" in variant_data:
                    variant.sku = variant_data["sku"]
                if "inventory_quantity" in variant_data:
                    variant.inventory_quantity = variant_data["inventory_quantity"]
                if "option1" in variant_data:
                    variant.option1 = variant_data["option1"]
                if "option2" in variant_data:
                    variant.option2 = variant_data["option2"]
                if "option3" in variant_data:
                    variant.option3 = variant_data["option3"]
                variants.append(variant)
            product.variants = variants
    
        # 画像の設定
        if "images" in arguments and arguments["images"]:
            for image_data in arguments["images"]:
                image = shopify.Image()
                image.src = image_data["src"]
                if "alt" in image_data:
                    image.alt = image_data["alt"]
                product.images.append(image)
    
        # 商品の保存
        product.save()
    
        return [
            types.TextContent(
                type="text",
                text=json.dumps(
                    {
                        "success": True,
                        "product_id": product.id,
                        "message": f"商品「{product.title}」が作成されました",
                    },
                    indent=2,
                    ensure_ascii=False,
                ),
            )
        ]
  • Registration of the 'create_product' tool in the list_tools handler, including the tool name, description, and detailed JSON Schema for input parameters defining the structure for creating a Shopify product.
    types.Tool(
        name="create_product",
        description="新しい商品を作成する",
        inputSchema={
            "type": "object",
            "properties": {
                "title": {"type": "string", "description": "商品名"},
                "body_html": {
                    "type": "string",
                    "description": "商品の説明(HTML形式)",
                },
                "vendor": {"type": "string", "description": "ベンダー名"},
                "product_type": {"type": "string", "description": "商品タイプ"},
                "tags": {"type": "string", "description": "タグ(カンマ区切り)"},
                "status": {
                    "type": "string",
                    "description": "ステータス",
                    "enum": ["active", "draft", "archived"],
                    "default": "active",
                },
                "variants": {
                    "type": "array",
                    "description": "バリエーション",
                    "items": {
                        "type": "object",
                        "properties": {
                            "price": {"type": "string", "description": "価格"},
                            "sku": {"type": "string", "description": "SKU"},
                            "inventory_quantity": {
                                "type": "number",
                                "description": "在庫数",
                            },
                            "option1": {
                                "type": "string",
                                "description": "オプション1の値",
                            },
                            "option2": {
                                "type": "string",
                                "description": "オプション2の値",
                            },
                            "option3": {
                                "type": "string",
                                "description": "オプション3の値",
                            },
                        },
                        "required": ["price"],
                    },
                },
                "options": {
                    "type": "array",
                    "description": "オプション",
                    "items": {
                        "type": "object",
                        "properties": {
                            "name": {
                                "type": "string",
                                "description": "オプション名",
                            },
                            "position": {
                                "position": "number",
                                "description": "オプション順番",
                            },
                            "values": {
                                "type": "array",
                                "description": "オプション値",
                                "items": {"type": "string"},
                            },
                        },
                        "required": ["name", "position", "values"],
                    },
                },
                "images": {
                    "type": "array",
                    "description": "画像",
                    "items": {
                        "type": "object",
                        "properties": {
                            "src": {"type": "string", "description": "画像URL"},
                            "alt": {
                                "type": "string",
                                "description": "代替テキスト",
                            },
                        },
                        "required": ["src"],
                    },
                },
            },
            "required": ["title"],
        },
    ),
  • JSON Schema defining the input parameters for the create_product tool, including required 'title', optional fields like body_html, vendor, variants (with price required), options, and images.
    inputSchema={
        "type": "object",
        "properties": {
            "title": {"type": "string", "description": "商品名"},
            "body_html": {
                "type": "string",
                "description": "商品の説明(HTML形式)",
            },
            "vendor": {"type": "string", "description": "ベンダー名"},
            "product_type": {"type": "string", "description": "商品タイプ"},
            "tags": {"type": "string", "description": "タグ(カンマ区切り)"},
            "status": {
                "type": "string",
                "description": "ステータス",
                "enum": ["active", "draft", "archived"],
                "default": "active",
            },
            "variants": {
                "type": "array",
                "description": "バリエーション",
                "items": {
                    "type": "object",
                    "properties": {
                        "price": {"type": "string", "description": "価格"},
                        "sku": {"type": "string", "description": "SKU"},
                        "inventory_quantity": {
                            "type": "number",
                            "description": "在庫数",
                        },
                        "option1": {
                            "type": "string",
                            "description": "オプション1の値",
                        },
                        "option2": {
                            "type": "string",
                            "description": "オプション2の値",
                        },
                        "option3": {
                            "type": "string",
                            "description": "オプション3の値",
                        },
                    },
                    "required": ["price"],
                },
            },
            "options": {
                "type": "array",
                "description": "オプション",
                "items": {
                    "type": "object",
                    "properties": {
                        "name": {
                            "type": "string",
                            "description": "オプション名",
                        },
                        "position": {
                            "position": "number",
                            "description": "オプション順番",
                        },
                        "values": {
                            "type": "array",
                            "description": "オプション値",
                            "items": {"type": "string"},
                        },
                    },
                    "required": ["name", "position", "values"],
                },
            },
            "images": {
                "type": "array",
                "description": "画像",
                "items": {
                    "type": "object",
                    "properties": {
                        "src": {"type": "string", "description": "画像URL"},
                        "alt": {
                            "type": "string",
                            "description": "代替テキスト",
                        },
                    },
                    "required": ["src"],
                },
            },
        },
        "required": ["title"],
    },
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. 'Create' implies a write/mutation operation, but the description doesn't mention required permissions, whether creation is idempotent, what happens on duplicate titles, or what the response contains. For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

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, efficient Japanese sentence that states the core purpose without any wasted words. It's appropriately sized for a creation tool and front-loads the essential information.

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?

For a complex product creation tool with 9 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what constitutes a successful creation, what data is returned, or how to handle the various nested structures (images, options, variants). The agent would need to guess about the mutation's behavior and results.

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?

The schema description coverage is 100%, with all 9 parameters well-documented in Japanese. The description adds no parameter information beyond what's already in the schema. According to guidelines, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

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

Purpose4/5

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

The description '新しい商品を作成する' (Create a new product) clearly states the verb ('create') and resource ('product'), making the purpose immediately understandable. It doesn't explicitly differentiate from siblings like 'update_product' or 'delete_product', but the verb 'create' inherently distinguishes it as a creation operation rather than modification or deletion.

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?

The description provides no guidance on when to use this tool versus alternatives like 'update_product' or 'list_products'. There's no mention of prerequisites, constraints, or appropriate contexts for creation versus other product operations. The agent must infer usage from the tool name alone.

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

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/kishimoto-banana/shopify-py-mcp'

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