Skip to content

OpenAPI spec with component references does not properly import descriptions #925

Open
@ianmcvann

Description

@ianmcvann

Description

I'm seeing a slightly odd behavior with how FastMCP seems to be handling recursive references in OpenAPI spec.

Take the JSON attached below, I would expect that it would extract the description from the format field and list it within component.description, but it seems to ignore it entirely. If I move the element in line though and remove references it works as expected.

Example Code

{
  "openapi": "3.0.0",
  "info" : {
    "description" : "Example Spec",
    "title" : "Example API",
    "version" : "1.0"
  },
    "servers" : [ {
    "description" : "Example API",
    "url" : "https://api.example.com"
  } ],
  "paths": {
    "/api/v1/test" : {
      "post" : {
        "description" : "Test",
        "operationId" : "test_post",
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/test_request_schema"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "OK"
            }
          }
        }
  }},
  "components": {
    "schemas": {
      "test_request_schema": {
        "properties": {
          "format": {
              "$ref" : "#/components/schemas/format"
            }
        }
      },
      "format" : {
        "default" : "1",
        "description" : "Test description",
        "enum" : [ "1", "2", "3", "4" ],
        "example" : "1",
        "title" : "format",
        "type" : "string"
      }
    }
  }
  }

Version Information

FastMCP version:                                                                                2.9.0
MCP version:                                                                                    1.9.4
Python version:                                                                               3.11.13
Platform:                                                                  macOS-15.0-arm64-arm-64bit
FastMCP root path: /Users/ianmcvann/Documents/netography/neto-mcp-server/.venv/lib/python3.11/s

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions