Skip to main content
Glama
kishimoto-banana

Shopify Python MCP Server

get_product

Retrieve detailed product information from Shopify stores using the product ID to streamline inventory management and e-commerce operations.

Instructions

商品の詳細情報を取得する

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
product_idYes商品ID

Implementation Reference

  • The main handler function that executes the 'get_product' tool: fetches product by ID using Shopify API, extracts and formats details including variants, options, and images, then returns JSON as TextContent.
    async def handle_get_product(arguments: dict) -> list[types.TextContent]:
        """商品の詳細情報を取得する"""
        product_id = arguments.get("product_id")
        if not product_id:
            raise ValueError("product_id is required")
    
        product = shopify.Product.find(product_id)
    
        # 商品情報を整形
        result = {
            "id": product.id,
            "title": product.title,
            "body_html": product.body_html,
            "vendor": product.vendor,
            "product_type": product.product_type,
            "created_at": product.created_at,
            "updated_at": product.updated_at,
            "status": product.status,
            "tags": product.tags,
            "variants": [],
            "options": [],
            "images": [],
        }
    
        # バリエーション情報
        for variant in product.variants:
            result["variants"].append(
                {
                    "id": variant.id,
                    "title": variant.title,
                    "price": variant.price,
                    "sku": variant.sku,
                    "inventory_quantity": variant.inventory_quantity,
                    "option1": variant.option1,
                    "option2": variant.option2,
                    "option3": variant.option3,
                }
            )
    
        # オプション情報
        for option in product.options:
            result["options"].append(
                {"id": option.id, "name": option.name, "values": option.values}
            )
    
        # 画像情報
        for image in product.images:
            result["images"].append({"id": image.id, "src": image.src, "alt": image.alt})
    
        return [
            types.TextContent(
                type="text",
                text=json.dumps(result, indent=2, ensure_ascii=False),
            )
        ]
  • Registers the 'get_product' tool in the MCP server's list_tools() callback, specifying name, description, and input schema.
    types.Tool(
        name="get_product",
        description="商品の詳細情報を取得する",
        inputSchema={
            "type": "object",
            "properties": {
                "product_id": {"type": "number", "description": "商品ID"}
            },
            "required": ["product_id"],
        },
    ),
  • Input JSON Schema for the 'get_product' tool: requires a 'product_id' number parameter.
    inputSchema={
        "type": "object",
        "properties": {
            "product_id": {"type": "number", "description": "商品ID"}
        },
        "required": ["product_id"],
    },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states this is a read operation ('取得する'), which implies it's non-destructive, but doesn't mention other important traits like authentication requirements, rate limits, error conditions, or what '詳細情報' (detailed information) specifically includes. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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

Conciseness4/5

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

The description is a single, efficient sentence in Japanese that directly states the tool's purpose without unnecessary words. It's appropriately sized for a simple read operation, though it could be slightly more informative without losing conciseness. There's no structural issue like burying key 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?

Given the tool's simplicity (one parameter, 100% schema coverage) and lack of annotations or output schema, the description is incomplete. It doesn't explain what '詳細情報' (detailed information) includes in the response, potential error cases (e.g., invalid product_id), or how this differs from sibling tools. For a read operation with no output schema, more context about return values would be helpful.

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 input schema has 100% description coverage, with the single parameter 'product_id' clearly documented as '商品ID' (product ID) in the schema. The description doesn't add any meaning beyond this—it doesn't explain what format the ID should be in, where to find it, or provide examples. Since the schema does the heavy lifting, the baseline score of 3 is appropriate.

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

Purpose3/5

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

The description '商品の詳細情報を取得する' (Get detailed product information) clearly states the verb '取得する' (get) and resource '商品の詳細情報' (detailed product information), making the purpose understandable. However, it doesn't distinguish this tool from its sibling 'list_products' (which presumably lists multiple products rather than getting details of a specific one), so it doesn't reach the highest clarity level.

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 'list_products' for browsing products or 'create_product' for adding new ones. It doesn't mention prerequisites (e.g., needing a valid product_id) or contextual constraints, leaving the agent to infer usage from the tool name and parameters 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