Skip to main content
Glama

generate_schema

Generate JSON-LD structured data for Schema.org types like Person, Product, and FAQPage using key-value field pairs to create semantic markup.

Instructions

Generate JSON-LD structured data for any Schema.org type. Provide the schema type and a set of key-value field pairs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYesThe Schema.org type to generate
fieldsYesKey-value pairs of schema fields and their values

Implementation Reference

  • The generate_schema tool is defined and implemented here, using an asynchronous handler to process different Schema.org types and generate the appropriate JSON-LD structure.
    server.tool(
      "generate_schema",
      "Generate JSON-LD structured data for any Schema.org type. Provide the schema type and a set of key-value field pairs.",
      {
        type: z
          .enum([
            "Person",
            "Organization",
            "Product",
            "FAQPage",
            "Article",
            "LocalBusiness",
            "Event",
            "WebSite",
            "BreadcrumbList",
            "HowTo",
            "Review",
            "VideoObject",
          ])
          .describe("The Schema.org type to generate"),
        fields: z
          .record(z.string(), z.unknown())
          .describe("Key-value pairs of schema fields and their values"),
      },
      async ({ type, fields }) => {
        let schema: object;
    
        if (type === "FAQPage" && fields.questions) {
          schema = buildFaqSchema({
            questions: fields.questions as Array<{ question: string; answer: string }>,
          });
        } else if (type === "BreadcrumbList" && fields.items) {
          const items = fields.items as Array<{ name: string; url: string }>;
          schema = {
            "@context": "https://schema.org",
            "@type": "BreadcrumbList",
            itemListElement: items.map((item, index) => ({
              "@type": "ListItem",
              position: index + 1,
              name: item.name,
              item: item.url,
            })),
          };
        } else if (type === "HowTo" && fields.steps) {
          const steps = fields.steps as Array<{
            name: string;
            text: string;
            image?: string;
            url?: string;
          }>;
          const howToFields: Record<string, unknown> = { ...fields };
          delete howToFields.steps;
          howToFields.step = steps.map((step, index) => ({
            "@type": "HowToStep",
            position: index + 1,
            name: step.name,
            text: step.text,
            ...(step.image ? { image: step.image } : {}),
            ...(step.url ? { url: step.url } : {}),
          }));
          schema = buildJsonLd(type, howToFields);
        } else {
          schema = buildJsonLd(type, fields);
        }
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(schema, null, 2),
            },
          ],
        };
      }
    );
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool generates JSON-LD data but doesn't disclose behavioral traits like whether it validates input fields against Schema.org standards, handles errors for invalid types/fields, returns a complete JSON-LD structure with @context, or has any rate limits or authentication requirements. The description is minimal and lacks operational context.

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 sentence that front-loads the core purpose and specifies required inputs. There is no wasted verbiage or redundancy, making it highly concise and well-structured for quick understanding.

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 no annotations, no output schema, and a tool that generates structured data (a non-trivial operation), the description is incomplete. It doesn't explain what the output looks like (e.g., JSON-LD format with @context), whether it includes error handling, or how it interacts with sibling tools. For a tool with 2 parameters and behavioral complexity, 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?

Schema description coverage is 100%, with both parameters well-documented in the schema (type with enum values, fields as key-value pairs). The description adds minimal value beyond the schema, only restating that parameters include 'the schema type and a set of key-value field pairs.' No additional semantics like field validation or examples are provided, meeting the baseline for high schema coverage.

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 JSON-LD structured data for any Schema.org type.' It specifies the verb ('Generate'), resource ('JSON-LD structured data'), and domain ('Schema.org type'). However, it doesn't explicitly differentiate from sibling tools like generate_person_schema or generate_product_schema, which appear to be specialized versions of this general-purpose tool.

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 its specialized siblings (e.g., generate_person_schema). It mentions what parameters to provide but doesn't indicate scenarios where this general tool is preferable over specific ones, or when alternatives like validate_schema might be relevant. Usage context is implied but not explicit.

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