Skip to main content
Glama
CSOAI-ORG

API Docs Generator AI MCP

generate_full_spec

Generate a complete OpenAPI 3.0 specification by providing endpoints as a JSON array of path, method, and summary. Ideal for creating structured API documentation from endpoint definitions.

Instructions

Generate a complete OpenAPI 3.0 spec. Pass endpoints_json as a JSON array of {path, method, summary} objects.

Behavior: This tool generates structured output without modifying external systems. Output is deterministic for identical inputs. No side effects. Free tier: 10/day rate limit. Pro tier: unlimited. No authentication required for basic usage.

When to use: Use this tool when you need structured analysis or classification of inputs against established frameworks or standards.

When NOT to use: Not suitable for real-time production decision-making without human review of results.

Args: title (str): The title to analyze or process. description (str): The description to analyze or process. version (str): The version to analyze or process. endpoints_json (str): The endpoints json to analyze or process. api_key (str): The api key to analyze or process.

Behavioral Transparency: - Side Effects: This tool is read-only and produces no side effects. It does not modify any external state, databases, or files. All output is computed in-memory and returned directly to the caller. - Authentication: No authentication required for basic usage. Pro/Enterprise tiers require a valid MEOK API key passed via the MEOK_API_KEY environment variable. - Rate Limits: Free tier: 10 calls/day. Pro tier: unlimited. Rate limit headers are included in responses (X-RateLimit-Remaining, X-RateLimit-Reset). - Error Handling: Returns structured error objects with 'error' key on failure. Never raises unhandled exceptions. Invalid inputs return descriptive validation errors. - Idempotency: Fully idempotent — calling with the same inputs always produces the same output. Safe to retry on timeout or transient failure. - Data Privacy: No input data is stored, logged, or transmitted to external services. All processing happens locally within the MCP server process.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes
descriptionYes
versionNo1.0.0
endpoints_jsonNo[]
api_keyNo

Implementation Reference

  • server.py:182-182 (registration)
    Tool registration via @mcp.tool() decorator
    @mcp.tool()
  • Handler function that generates a complete OpenAPI 3.0 spec from title, description, version, and a JSON array of endpoint definitions. Parses endpoints, builds path/method entries, and returns the full spec object.
    @mcp.tool()
    def generate_full_spec(
        title: str, description: str, version: str = "1.0.0", endpoints_json: str = "[]"
    , api_key: str = "") -> dict:
        """Generate a complete OpenAPI 3.0 spec. Pass endpoints_json as a JSON array of {path, method, summary} objects.
    
        Behavior:
            This tool generates structured output without modifying external systems.
            Output is deterministic for identical inputs. No side effects.
            Free tier: 10/day rate limit. Pro tier: unlimited.
            No authentication required for basic usage.
    
        When to use:
            Use this tool when you need structured analysis or classification
            of inputs against established frameworks or standards.
    
        When NOT to use:
            Not suitable for real-time production decision-making without
            human review of results.
    
        Args:
            title (str): The title to analyze or process.
            description (str): The description to analyze or process.
            version (str): The version to analyze or process.
            endpoints_json (str): The endpoints json to analyze or process.
            api_key (str): The api key to analyze or process.
    
        Behavioral Transparency:
            - Side Effects: This tool is read-only and produces no side effects. It does not modify
              any external state, databases, or files. All output is computed in-memory and returned
              directly to the caller.
            - Authentication: No authentication required for basic usage. Pro/Enterprise tiers
              require a valid MEOK API key passed via the MEOK_API_KEY environment variable.
            - Rate Limits: Free tier: 10 calls/day. Pro tier: unlimited. Rate limit headers are
              included in responses (X-RateLimit-Remaining, X-RateLimit-Reset).
            - Error Handling: Returns structured error objects with 'error' key on failure.
              Never raises unhandled exceptions. Invalid inputs return descriptive validation errors.
            - Idempotency: Fully idempotent — calling with the same inputs always produces the
              same output. Safe to retry on timeout or transient failure.
            - Data Privacy: No input data is stored, logged, or transmitted to external services.
              All processing happens locally within the MCP server process.
        """
        allowed, msg, tier = check_access(api_key)
        if not allowed:
            return {"error": msg, "upgrade_url": "https://meok.ai/pricing"}
    
        if not _check_rate():
            return {"error": "Rate limit exceeded (50/day)"}
        try:
            endpoints = json.loads(endpoints_json)
        except json.JSONDecodeError:
            return {"error": "Invalid JSON for endpoints_json"}
        paths: dict = {}
        for ep in endpoints:
            p = ep.get("path", "/")
            m = ep.get("method", "get").lower()
            s = ep.get("summary", "")
            if p not in paths:
                paths[p] = {}
            paths[p][m] = {
                "summary": s,
                "operationId": p.strip("/").replace("/", "_") + f"_{m}",
                "responses": {"200": {"description": "Success", "content": {"application/json": {"schema": {"type": "object"}}}}},
            }
        spec = {
            "openapi": "3.0.3",
            "info": {"title": title, "description": description, "version": version},
            "paths": paths,
            "components": {"schemas": {}},
        }
        return {"spec": spec}
  • Rate limiting helper used by generate_full_spec to enforce 50 calls/day limit
    def _check_rate() -> bool:
        now = time.time()
        _calls[:] = [t for t in _calls if now - t < 86400]
        if len(_calls) >= DAILY_LIMIT:
            return False
        _calls.append(now)
        return True
  • Authentication and access control helper imported from auth_middleware; called by generate_full_spec to check API key and tier limits
    def check_access(api_key: str = "", framework: str = None) -> Tuple[bool, str, Tier]:
        """
        Main access control function. Returns (allowed, message, tier).
        Call at the start of every tool.
        """
        tier = get_tier_from_api_key(api_key)
        limits = TIER_LIMITS[tier]
        
        # Rate limit check
        usage = _load_json(USAGE_FILE)
        today = time.strftime("%Y-%m-%d")
        key_hash = hashlib.sha256((api_key or "anon").encode()).hexdigest()[:12]
        day_key = f"{key_hash}:{today}"
        
        current = usage.get(day_key, 0)
        max_calls = limits["calls_per_day"]
        
        if max_calls != -1 and current >= max_calls:
            return (
                False,
                f"Rate limit reached ({max_calls}/day on {tier.value} tier). "
                f"Upgrade at https://meok.ai/pricing",
                tier,
            )
        
        # Record usage
        usage[day_key] = current + 1
        # Clean old entries (keep last 7 days)
        cutoff = time.strftime("%Y-%m-%d", time.localtime(time.time() - 7 * 86400))
        usage = {k: v for k, v in usage.items() if k.split(":")[1] >= cutoff}
        _save_json(USAGE_FILE, usage)
        
        return True, "OK", tier
Behavior5/5

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

With no annotations provided, the description fully covers behavioral traits including side effects (read-only), authentication, rate limits, error handling, idempotency, and data privacy. This is comprehensive and exceeds typical expectations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured into sections but is verbose. It repeats information (e.g., behavioral details in two places) and includes redundant lists that mirror the schema. Could be more concise without losing clarity.

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?

The description covers overall purpose, input format, and behavioral traits. However, it lacks details on the output format (JSON? YAML?) and how required parameters (title, description) contribute to the spec. The tool's documentation is adequate but has clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. However, parameter descriptions are generic and tautological (e.g., 'The title to analyze or process'). Only endpoints_json receives meaningful context in the opening paragraph. Most parameters lack specific guidance on expected values or formats.

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?

The description clearly states it generates a complete OpenAPI 3.0 spec and specifies the input format (endpoints_json as JSON array). It is distinct from siblings like generate_endpoint, generate_schema, add_auth_to_spec, and validate_spec.

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?

The description includes explicit 'When to use' and 'When NOT to use' sections, guiding the agent on appropriate contexts. However, it does not directly compare to sibling tools or provide specific exclusions for when to use alternatives.

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/CSOAI-ORG/api-docs-generator-ai-mcp'

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