Skip to main content
Glama

generate_article_schema

Creates structured JSON-LD schema markup for articles to enhance search engine visibility and rich results.

Instructions

Generate an Article JSON-LD schema for blog posts, news articles, or other written content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
headlineYesTitle of the article
authorNoAuthor name
datePublishedNoPublication date (ISO 8601 format)
dateModifiedNoLast modified date (ISO 8601 format)
imageNoArticle image URL
publisherNoPublisher organization name
descriptionNoArticle summary or excerpt
urlNoURL of the article

Implementation Reference

  • The handler for the 'generate_article_schema' tool, which calls buildArticleSchema and returns the result as JSON.
    async (params) => {
      const schema = buildArticleSchema(params);
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify(schema, null, 2),
          },
        ],
      };
  • The helper function that constructs the Article JSON-LD schema object.
    function buildArticleSchema(params: {
      headline: string;
      author?: string;
      datePublished?: string;
      dateModified?: string;
      image?: string;
      publisher?: string;
      description?: string;
      url?: string;
    }): object {
      const fields: Record<string, unknown> = { headline: params.headline };
      if (params.author) {
        fields.author = {
          "@type": "Person",
          name: params.author,
        };
      }
      if (params.datePublished) fields.datePublished = params.datePublished;
      if (params.dateModified) fields.dateModified = params.dateModified;
      if (params.image) fields.image = params.image;
      if (params.publisher) {
        fields.publisher = {
          "@type": "Organization",
          name: params.publisher,
        };
      }
      if (params.description) fields.description = params.description;
      if (params.url) fields.url = params.url;
      return buildJsonLd("Article", fields);
    }
    
    function buildOrganizationSchema(params: {
      name: string;
      url?: string;
  • The registration of the 'generate_article_schema' tool, including its parameter schema definition.
    server.tool(
      "generate_article_schema",
      "Generate an Article JSON-LD schema for blog posts, news articles, or other written content.",
      {
        headline: z.string().describe("Title of the article"),
        author: z.string().optional().describe("Author name"),
        datePublished: z
          .string()
          .optional()
          .describe("Publication date (ISO 8601 format)"),
        dateModified: z
          .string()
          .optional()
          .describe("Last modified date (ISO 8601 format)"),
        image: z.string().optional().describe("Article image URL"),
        publisher: z.string().optional().describe("Publisher organization name"),
        description: z.string().optional().describe("Article summary or excerpt"),
        url: z.string().optional().describe("URL of the article"),
      },

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