Skip to main content
Glama

wp_seo_validate_schema

Validate JSON-LD schema markup for correctness and compliance with SEO standards to improve search engine visibility.

Instructions

Validate JSON-LD schema markup for correctness and compliance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteNoSite identifier for multi-site setups
schemaYesJSON-LD schema object to validate
schemaTypeNoExpected schema type for validation
useGoogleValidatorNoUse Google's Rich Results Test API for validation

Implementation Reference

  • The primary MCP handler function for the wp_seo_validate_schema tool. It processes input arguments, constructs parameters, and delegates execution to the SEOTools instance's validateSchema method.
    export async function handleValidateSchema(client: WordPressClient, args: Record<string, unknown>): Promise<unknown> {
      const logger = LoggerFactory.tool("wp_seo_validate_schema");
    
      try {
        const seoTools = getSEOToolsInstance();
        const params: SEOToolParams = {
          schema: args.schema,
          schemaType: args.schemaType as SchemaType,
          site: args.site as string,
        };
    
        // Add Google validator flag if provided
        if (args.useGoogleValidator) {
          params.useGoogleValidator = args.useGoogleValidator as boolean;
        }
    
        return await seoTools.validateSchema(params);
      } catch (error) {
        logger.error("Failed to validate schema", { error, args });
        throw error;
      }
    }
  • Tool definition including name, description, and input schema for the wp_seo_validate_schema tool, used for MCP registration.
    export const validateSchemaTool: Tool = {
      name: "wp_seo_validate_schema",
      description: "Validate JSON-LD schema markup for correctness and compliance",
      inputSchema: {
        type: "object",
        properties: {
          schema: {
            type: "object",
            description: "JSON-LD schema object to validate",
          },
          schemaType: {
            type: "string",
            description: "Expected schema type for validation",
          },
          useGoogleValidator: {
            type: "boolean",
            description: "Use Google's Rich Results Test API for validation",
          },
          site: {
            type: "string",
            description: "Site identifier for multi-site setups",
          },
        },
        required: ["schema"],
      },
    };
  • Handler mapping function that associates the tool name 'wp_seo_validate_schema' with its handler function handleValidateSchema. Used by getTools() for MCP tool registration.
    private getHandlerForTool(toolName: string): unknown {
      const handlers: Record<string, unknown> = {
        wp_seo_analyze_content: handleAnalyzeContent,
        wp_seo_generate_metadata: handleGenerateMetadata,
        wp_seo_bulk_update_metadata: handleBulkUpdateMetadata,
        wp_seo_generate_schema: handleGenerateSchema,
        wp_seo_validate_schema: handleValidateSchema,
        wp_seo_suggest_internal_links: handleSuggestInternalLinks,
        wp_seo_site_audit: handlePerformSiteAudit,
        wp_seo_track_serp: handleTrackSERPPositions,
        wp_seo_keyword_research: handleKeywordResearch,
        wp_seo_test_integration: handleTestSEOIntegration,
        wp_seo_get_live_data: handleGetLiveSEOData,
      };
    
      return (
        handlers[toolName] ||
        (() => {
          throw new Error(`Unknown SEO tool: ${toolName}`);
        })
      );
    }
  • Core implementation method in SEOTools class that performs the schema validation logic, including caching, error handling, and delegation to performSchemaValidation.
    async validateSchema(params: SEOToolParams): Promise<unknown> {
      const siteLogger = LoggerFactory.tool("wp_seo_validate_schema", params.site);
    
      return await siteLogger.time("Validate schema markup", async () => {
        try {
          validateRequired(params, ["schema"]);
    
          // Implementation will be added in validators
          const validation = await this.performSchemaValidation(params);
    
          return validation;
        } catch (_error) {
          handleToolError(_error, "validate schema", {
            site: params.site,
          });
          throw _error;
        }
      });
    }
  • Private helper method that executes the actual schema validation using SchemaGenerator and formats the response.
    private async performSchemaValidation(params: SEOToolParams): Promise<unknown> {
      if (!params.schema) {
        throw new Error("Schema markup is required for validation");
      }
    
      // Basic validation using the SchemaGenerator's validation method
      const validation = this.schemaGenerator.validateSchema(params.schema as SchemaMarkup);
    
      return {
        valid: validation.valid,
        errors: validation.errors,
        warnings: [], // Could add warnings for best practices
        schemaType: (params.schema as SchemaMarkup)["@type"],
        validatedAt: new Date().toISOString(),
      };
    }
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 the tool validates for 'correctness and compliance', but doesn't explain what this entails—such as validation standards (e.g., Schema.org), error reporting format, whether it's read-only or has side effects, or performance implications. For a validation tool with zero annotation coverage, this is insufficient, scoring a 2.

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: 'Validate JSON-LD schema markup for correctness and compliance'. It's front-loaded with the core purpose, has zero wasted words, and is appropriately sized for the tool's complexity. Every word earns its place, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (4 parameters, nested objects, no output schema), the description is minimally adequate. It states what the tool does but lacks details on behavior, usage, or output. Without annotations or an output schema, the agent is left guessing about validation results or error handling. It meets the bare minimum for a validation tool, scoring a 3.

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, so the schema already documents all four parameters. The description doesn't add any parameter-specific details beyond what's in the schema, such as examples of valid schema objects or clarification on 'site' usage. With high schema coverage, the baseline is 3, as the description doesn't compensate but doesn't need to heavily.

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: 'Validate JSON-LD schema markup for correctness and compliance'. It specifies the action (validate) and the resource (JSON-LD schema markup), and distinguishes itself from sibling tools like 'wp_seo_generate_schema' or 'wp_seo_analyze_content' by focusing on validation rather than generation or analysis. However, it doesn't explicitly differentiate from all SEO siblings, keeping it at a 4 instead of 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 prerequisites, appropriate contexts, or when to choose validation over other SEO tools like 'wp_seo_generate_schema' or 'wp_seo_site_audit'. The lack of usage instructions leaves the agent without clear direction, scoring a 2 for minimal guidance.

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/docdyhr/mcp-wordpress'

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