Skip to main content
Glama
MCP API OAS Checker

MCP API OAS Checker

Official
by italia

Validate OpenAPI Specification

validate_openapi
Read-onlyIdempotent

Validates OpenAPI (OAS3) specifications against Italian Public Administration guidelines using Spectral, returning rule-grouped issues and fix guidance for local files or raw content.

Instructions

Validate an OpenAPI specification (OAS3) against Italian Public Administration guidelines using Spectral.

Runs the official Italian PA linting rules on the provided OpenAPI document and returns a structured report of issues found, grouped by rule with fix guidance.

Args:

  • openapi_path (string, optional): Absolute path to a local OpenAPI file (YAML/JSON). Mutually exclusive with openapi_content.

  • openapi_content (string, optional): Raw OpenAPI content as a string. Mutually exclusive with openapi_path.

  • standard_ruleset (string, optional): Ruleset to use: 'spectral' (default, core), 'spectral-full' (all+security), 'spectral-generic' (generic API), 'spectral-security' (security).

  • ruleset_path (string, optional): URL or local path to a custom Spectral ruleset. Overrides standard_ruleset.

  • allowed_rules (string[], optional): Only check these rule codes (e.g. ['has-contact', 'use-semver']). If omitted, all rules.

  • filter_path (string, optional): Only show issues whose JSON path contains this string (e.g. 'paths./users').

  • line_start (number, optional): Only show issues on or after this line (1-indexed).

  • line_end (number, optional): Only show issues on or before this line (1-indexed).

  • max_issues (number, optional): Cap the number of issues returned. Default: 20.

Returns: A text report with two sections:

  1. "Rules violated (with fix guidance)" — each violated rule listed once with severity and description.

  2. "Locations" — compact list of line numbers and rule codes.

Example output: Found 3 issues:

Rules violated (with fix guidance):

  • has-contact [Error]: API MUST reference a contact...

  • use-semver [Error]: The API version field should follow semver.

Locations:

L2: has-contact L2: use-semver L5: has-contact

Examples:

  • Validate a local file: { "openapi_path": "/home/user/api.yaml" }

  • Validate pasted content: { "openapi_content": "openapi: 3.0.3\ninfo:..." }

  • Check only security rules: { "openapi_path": "/home/user/api.yaml", "standard_ruleset": "spectral-security" }

  • Focus on a specific path: { "openapi_path": "/home/user/api.yaml", "filter_path": "paths./users" }

Error Handling:

  • Returns error if neither openapi_path nor openapi_content is provided.

  • Returns error if Spectral binary is not found or fails to execute.

  • Returns error if the ruleset cannot be fetched or parsed.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "validate_openapi"
  }
}

Input Schema

NameRequiredDescriptionDefault
line_endNoFilter results up to this line number (1-indexed, inclusive).
line_startNoFilter results starting from this line number (1-indexed, inclusive).
max_issuesNoMaximum number of issues to return. Default: 20.
filter_pathNoFilter results by JSON path substring (e.g. 'paths./users', 'info.contact'). Only issues whose path contains this string are returned.
openapi_pathNoAbsolute path to a local OpenAPI file (YAML or JSON). Provide either this or openapi_content.
ruleset_pathNoURL or absolute local path to a custom Spectral ruleset file. Overrides standard_ruleset.
allowed_rulesNoWhitelist of rule codes to check (e.g. ['has-contact', 'use-semver']). If omitted, all rules are checked.
openapi_contentNoRaw OpenAPI specification content (YAML or JSON string). Provide either this or openapi_path.
standard_rulesetNoStandard Italian PA ruleset to use: 'spectral' (default, core rules), 'spectral-full' (all rules incl. security), 'spectral-generic' (generic API rules), 'spectral-security' (security-focused rules).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.4/5.0
Behavior5/5

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

Goes well beyond the readOnly/idempotent annotations: it discloses the external Spectral binary dependency, the error conditions (missing input, binary not found, unparseable ruleset), the default issue cap of 20, and the grouped output structure. These are exactly the operational facts an agent needs before invoking.

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?

Front-loaded with purpose, then Args/Returns/Examples/Error Handling in a predictable order. Slightly verbose because the parameter block duplicates full schema text and the sample output is longer than needed, but nothing is genuinely wasteful.

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

Completeness5/5

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

With nine optional parameters, no required fields, and no output schema, the description carries the full burden and does so: it explains the return format with a worked example, states the error conditions, and clarifies that omitting input is an error. An agent can call this correctly without further context.

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 already 100%, so the parameter list in the description largely restates the schema, including the mutual exclusivity and the override precedence for ruleset_path. The added value is limited to inline example values, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Validate an OpenAPI specification (OAS3)') plus the rule engine and standards body (Spectral, Italian PA guidelines). This is clearly distinguishable from siblings like list_rules or get_rule_guidance, which do not run validation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Concrete usage examples cover the main call patterns (local file, pasted content, security-only ruleset, path filter), and the mutual exclusivity of openapi_path/openapi_content is stated. It does not explicitly contrast when to reach for this versus the sibling guidance tools, so it falls short of a full 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools