Skip to content

json_schema _retrieve_ref fails to process list element with dict lookup method #32012

@gzc9047

Description

@gzc9047

elif component.isdigit() and int(component) in out:

Relates to Softeria/ms-365-mcp-server#36.

It fails when process API definition from MCP server like below. When $ref element in list (ccRecipients refers bccRecipients), should use index related check.

{
  "tools": [
    {
      "name": "send-mail",
      "description": "Send the message specified in the request body using either JSON or MIME format. When using JSON format, you can include a file attachment in the same sendMail action call. When using MIME format: This method saves the message in the Sent Items folder. Alternatively, create a draft message to send later. To learn more about the steps involved in the backend before a mail is delivered to recipients, see here.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "body": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "properties": {
                  "Message": {
                    "type": "object",
                    "properties": {
                      "bccRecipients": {
                        "type": "array",
                        "items": {
                          ...
                        },
                        "description": "The Bcc: recipients for the message."
                      },
                      "ccRecipients": {
                        "type": "array",
                        "items": {
                          "$ref": "#/properties/body/anyOf/1/properties/Message/properties/bccRecipients/items"
                        },
                        "description": "The Cc: recipients for the message."
                      }
                    },
                    "additionalProperties": false
                  },
                  "SaveToSentItems": {
                    "type": [
                      "boolean",
                      "null"
                    ],
                    "default": false
                  }
                },
                "additionalProperties": false
              }
            ]
          }
        },
        "required": [
          "body"
        ],
        "additionalProperties": false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      },
      "annotations": {
        "title": "send-mail",
        "readOnlyHint": false
      }
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreRelated to the package `langchain-core`help wantedGood issue for contributors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions