generate_faq_schema
Generate FAQPage JSON-LD schema markup from question-answer pairs to enhance search visibility and structured data.
Instructions
Generate a FAQPage JSON-LD schema from a list of question-answer pairs.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| questions | Yes | Array of question-answer pairs |
Implementation Reference
- mcp-server/src/index.ts:250-267 (handler)Implementation of the logic to build the FAQ schema.
function buildFaqSchema(params: { questions: Array<{ question: string; answer: string }>; }): object { const mainEntity = params.questions.map((q) => ({ "@type": "Question", name: q.question, acceptedAnswer: { "@type": "Answer", text: q.answer, }, })); return { "@context": "https://schema.org", "@type": "FAQPage", mainEntity, }; } - mcp-server/src/index.ts:606-630 (registration)Registration of the 'generate_faq_schema' tool and call to the handler.
server.tool( "generate_faq_schema", "Generate a FAQPage JSON-LD schema from a list of question-answer pairs.", { questions: z .array( z.object({ question: z.string().describe("The question text"), answer: z.string().describe("The answer text"), }) ) .describe("Array of question-answer pairs"), }, async (params) => { const schema = buildFaqSchema(params); return { content: [ { type: "text" as const, text: JSON.stringify(schema, null, 2), }, ], }; } );