Skip to content

Conversation

@max-stytch
Copy link
Contributor

Motivation and Context

Partially resolves of #332 - this PR restores the array logic that was removed in #284, but only when all nested objects are also "simple" objects.

How Has This Been Tested?

Validated against the JSON schema in this comment - nested items are rendered appropriately
image

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@cliffhall
Copy link
Member

Hi @max-stytch I tried testing with a schema based on the shape you linked to but when I click the Add Item button, it doesn't show a field like it does in your screenshot. Have I got the schema wrong?

Screenshot 2025-05-27 at 10 50 47 AM
test-form.mov

@cliffhall cliffhall added the waiting on submitter Waiting for the submitter to provide more info label Jun 2, 2025
@olaservo
Copy link
Member

Hi @max-stytch we merged a larger set of changes here which I think will have addressed both this and the required issue that you pointed out: #480

@max-stytch
Copy link
Contributor Author

max-stytch commented Jun 28, 2025 via email

@max-stytch max-stytch closed this Jun 28, 2025
@cliffhall
Copy link
Member

@max-stytch I think there were some crossed wires here. @olaservo's comment that led you to close this I think was mistaken. This was about the form handling and #480 was about fixing a problem where we had the required field as a boolean rather than an array. I think we still need this. We also need a tool in the everything server that has a complex inputSchema to test with.

@cliffhall cliffhall reopened this Aug 7, 2025
@richardkmichael
Copy link
Collaborator

richardkmichael commented Aug 15, 2025

I was doing unrelated inputSchema investigation with a testing server and tool, and had taken note of this issue, so I checked the form rendering. I think the form for arrays is fixed.

There is a slight quirk, that objects with typed properties do not initialize default values the same as primitive fields. Skimming the code, I think this is because in the object case getArrayItemDefault() is not called for the default values of the types of the object properties. Also, the typed_objects object case might be sorted out by inspecting additionalProperties, not properties. All of this is in isSimpleObject().

Here's the tool schema, and a screenshot of the form. (I added alternating bounding boxes in the screenshot just to make the form layout clearer. I think the layout can be improved.)

I can add such a tool to the Everything Server.

{
  "tools": [
    {
      "name": "complex_input_schema_tool",
      "description": "Tool that handles complex input schemas with mixed-type arrays.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "numbers": {
            "description": "An array of numbers",
            "items": {
              "type": "number"
            },
            "title": "Numbers",
            "type": "array"
          },
          "strings": {
            "description": "An array of strings",
            "items": {
              "type": "string"
            },
            "title": "Strings",
            "type": "array"
          },
          "objects": {
            "description": "An array of objects (dicts)",
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Objects",
            "type": "array"
          },
          "typed_objects": {
            "description": "An array of objects with 'word' (str) and 'length' (int) properties",
            "items": {
              "additionalProperties": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "integer"
                  }
                ]
              },
              "type": "object"
            },
            "title": "Typed Objects",
            "type": "array"
          },
          "structured_objects": {
            "description": "An array of structured objects with defined word and length properties",
            "items": {
              "properties": {
                "word": {
                  "title": "Word",
                  "type": "string"
                },
                "length": {
                  "title": "Length",
                  "type": "integer"
                }
              },
              "required": [
                "word",
                "length"
              ],
              "title": "WordItem",
              "type": "object"
            },
            "title": "Structured Objects",
            "type": "array"
          },
          "mixed": {
            "description": "An array of non-uniform types (int, str, bool, dict, etc.)",
            "items": {},
            "title": "Mixed",
            "type": "array"
          },
          "str_and_int": {
            "description": "An array containing only strings and integers",
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "title": "Str And Int",
            "type": "array"
          }
        },
        "required": [
          "numbers",
          "strings",
          "objects",
          "typed_objects",
          "structured_objects",
          "mixed",
          "str_and_int"
        ]
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "result": {
            "title": "Result",
            "type": "string"
          }
        },
        "required": [
          "result"
        ],
      },
      "_meta": {
        "_fastmcp": {
          "tags": []
        }
      }
    }
  ]
}
Screenshot 2025-08-15 at 00 31 45

@cliffhall
Copy link
Member

I was doing unrelated inputSchema investigation with a testing server and tool, and had taken note of this issue, so I checked the form rendering. I think the form for arrays is fixed

@richardkmichael Fixed in the existing Inspector or with this PR?

I can add such a tool to the Everything Server.

This would be nice.

@richardkmichael
Copy link
Collaborator

I was doing unrelated inputSchema investigation with a testing server and tool, and had taken note of this issue, so I checked the form rendering. I think the form for arrays is fixed

@richardkmichael Fixed in the existing Inspector or with this PR?

On main, without this PR. (Sorry, I had realized my comment was ambiguous and meant to come back and edit it.)

I can add such a tool to the Everything Server.

This would be nice.

Will do.

@max-stytch max-stytch closed this Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting on submitter Waiting for the submitter to provide more info

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants