Skip to main content
Glama

generate_product_schema

Create structured JSON-LD markup for products to enhance search visibility with pricing, availability, brand, and SKU details.

Instructions

Generate a Product JSON-LD schema with pricing, brand, availability, and other product details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesProduct name
descriptionNoProduct description
imageNoProduct image URL
brandNoBrand name
skuNoStock Keeping Unit identifier
priceNoPrice of the product
priceCurrencyNoCurrency code (e.g., USD, EUR, GBP)
availabilityNoProduct availability status
urlNoProduct page URL

Implementation Reference

  • The handler logic for the 'generate_product_schema' tool, which calls 'buildProductSchema'.
    async (params) => {
      const schema = buildProductSchema(params);
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify(schema, null, 2),
          },
        ],
  • The helper function that constructs the product schema object.
    function buildProductSchema(params: {
      name: string;
      description?: string;
      image?: string;
      brand?: string;
      sku?: string;
      price?: string;
      priceCurrency?: string;
      availability?: string;
      url?: string;
    }): object {
      const fields: Record<string, unknown> = { name: params.name };
      if (params.description) fields.description = params.description;
      if (params.image) fields.image = params.image;
      if (params.brand) {
        fields.brand = {
          "@type": "Brand",
          name: params.brand,
        };
      }
      if (params.sku) fields.sku = params.sku;
      if (params.url) fields.url = params.url;
      if (params.price || params.priceCurrency || params.availability) {
        const offers: Record<string, unknown> = {
          "@type": "Offer",
        };
        if (params.price) offers.price = params.price;
        if (params.priceCurrency) offers.priceCurrency = params.priceCurrency;
        if (params.availability) {
          offers.availability = `https://schema.org/${params.availability}`;
        }
        fields.offers = offers;
      }
      return buildJsonLd("Product", fields);
    }
  • Registration of the 'generate_product_schema' tool, including its input schema definitions.
    server.tool(
      "generate_product_schema",
      "Generate a Product JSON-LD schema with pricing, brand, availability, and other product details.",
      {
        name: z.string().describe("Product name"),
        description: z.string().optional().describe("Product description"),
        image: z.string().optional().describe("Product image URL"),
        brand: z.string().optional().describe("Brand name"),
        sku: z.string().optional().describe("Stock Keeping Unit identifier"),
        price: z.string().optional().describe("Price of the product"),
        priceCurrency: z
          .string()
          .optional()
          .describe("Currency code (e.g., USD, EUR, GBP)"),
        availability: z
          .enum(["InStock", "OutOfStock", "PreOrder", "Discontinued"])
          .optional()
          .describe("Product availability status"),
        url: z.string().optional().describe("Product page URL"),
      },
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool generates a schema but doesn't describe what the output looks like (e.g., JSON-LD format), whether it validates inputs, if it's idempotent, or any error handling. For a tool with no 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 that front-loads the core purpose. It avoids redundancy and wastes no words, though it could be slightly more structured by explicitly listing key parameters or differentiating from siblings.

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 complexity (9 parameters, no output schema, no annotations), the description is insufficient. It doesn't explain the output format (JSON-LD), how to use the generated schema, or any behavioral aspects like validation or error handling. For a tool with rich input schema but no other structured data, more context is needed.

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 description mentions 'pricing, brand, availability, and other product details,' which aligns with some parameters in the schema (e.g., price, brand, availability). However, with 100% schema description coverage, the schema already documents all parameters thoroughly. The description adds minimal value beyond what the schema provides, meeting the baseline of 3.

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 clearly states the tool's purpose: 'Generate a Product JSON-LD schema with pricing, brand, availability, and other product details.' It specifies the verb ('Generate'), resource ('Product JSON-LD schema'), and key fields included. However, it doesn't explicitly differentiate from sibling tools like 'generate_schema' or 'generate_article_schema', which would require a 5.

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. It doesn't mention sibling tools like 'generate_schema' (which might be more general) or 'generate_article_schema', nor does it specify prerequisites or appropriate contexts for generating product schemas versus other types.

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/sharozdawa/schema-gen'

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