KEMBAR78
Account for the "required fields" list in the mcp_input_schema by AnuradhaKaruppiah · Pull Request #360 · NVIDIA/NeMo-Agent-Toolkit · GitHub
Skip to content

Conversation

@AnuradhaKaruppiah
Copy link
Contributor

@AnuradhaKaruppiah AnuradhaKaruppiah commented Jun 10, 2025

Closes #354
If no default is defined in the schema, and the field isn’t in the "required" list, it should default to None (i.e., optional).

Earlier logic marked the field as required (using ...) unless "default" is explicitly set i.e. it would mark optional fields with no default as required.

This failed for tools like kubectl_get -

Starting Kubernetes MCP server v0.1.0, handling commands...
Tool: kubectl_get
Description: Get or list Kubernetes resources by resource type, name, and optionally namespace
Input Schema:
{
  "type": "object",
  "properties": {
    "resourceType": {
      "type": "string",
      "description": "Type of resource to get (e.g., pods, deployments, services, configmaps, events, etc.)"
    },
    "name": {
      "type": "string",
      "description": "Name of the resource (optional - if not provided, lists all resources of the specified type)"
    },
    "namespace": {
      "type": "string",
      "description": "Namespace of the resource (optional - defaults to 'default' for namespaced resources)",
      "default": "default"
    },
    "output": {
      "type": "string",
      "enum": [
        "json",
        "yaml",
        "wide",
        "name",
        "custom"
      ],
      "description": "Output format",
      "default": "json"
    },
    "allNamespaces": {
      "type": "boolean",
      "description": "If true, list resources across all namespaces",
      "default": false
    },
    "labelSelector": {
      "type": "string",
      "description": "Filter resources by label selector (e.g. 'app=nginx')",
      "optional": true
    },
    "fieldSelector": {
      "type": "string",
      "description": "Filter resources by field selector (e.g. 'metadata.name=my-pod')",
      "optional": true
    },
    "sortBy": {
      "type": "string",
      "description": "Sort events by a field (default: lastTimestamp). Only applicable for events.",
      "optional": true
    }
  },
  "required": [
    "resourceType"
  ]
}

Description

By Submitting this PR I confirm:

  • I am familiar with the Contributing Guidelines.
  • We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
    • Any contribution which contains commits that are not Signed-Off will not be accepted.
  • When the PR is ready for review, new or existing tests cover these changes.
  • When the PR is ready for review, the documentation is up to date with these changes.

If no default is defined in the schema, and the field isn’t in
the "required" list, it should default to None (i.e., optional).

Earlier logic marked the field as required (using ...) unless
"default" is explicitly set i.e. it would mark optional fields
with no default as required.

Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
@AnuradhaKaruppiah AnuradhaKaruppiah self-assigned this Jun 10, 2025
@AnuradhaKaruppiah AnuradhaKaruppiah added bug Something isn't working non-breaking Non-breaking change labels Jun 10, 2025
Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
@AnuradhaKaruppiah
Copy link
Contributor Author

/ok to test 797f1a6

Copy link
Collaborator

@mdemoret-nv mdemoret-nv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AnuradhaKaruppiah
Copy link
Contributor Author

/merge

@AnuradhaKaruppiah
Copy link
Contributor Author

/ok to test 046dc63

Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
@AnuradhaKaruppiah
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit 3889ce3 into NVIDIA:develop Jun 12, 2025
21 checks passed
@AnuradhaKaruppiah AnuradhaKaruppiah deleted the ak-mcp-required-fields branch June 12, 2025 23:39
AnuradhaKaruppiah added a commit to AnuradhaKaruppiah/oss-agentiq that referenced this pull request Aug 4, 2025
…A#360)

## By Submitting this PR I confirm:
- I am familiar with the [Contributing Guidelines](https://github.com/NVIDIA/AIQToolkit/blob/develop/docs/source/resources/contributing.md).
- We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
  - Any contribution which contains commits that are not Signed-Off will not be accepted.
- When the PR is ready for review, new or existing tests cover these changes.
- When the PR is ready for review, the documentation is up to date with these changes.

Authors:
  - Anuradha Karuppiah (https://github.com/AnuradhaKaruppiah)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: NVIDIA#360
scheckerNV pushed a commit to scheckerNV/aiq-factory-reset that referenced this pull request Aug 22, 2025
…A#360)

## By Submitting this PR I confirm:
- I am familiar with the [Contributing Guidelines](https://github.com/NVIDIA/AIQToolkit/blob/develop/docs/source/resources/contributing.md).
- We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
  - Any contribution which contains commits that are not Signed-Off will not be accepted.
- When the PR is ready for review, new or existing tests cover these changes.
- When the PR is ready for review, the documentation is up to date with these changes.

Authors:
  - Anuradha Karuppiah (https://github.com/AnuradhaKaruppiah)

Approvers:
  - Michael Demoret (https://github.com/mdemoret-nv)

URL: NVIDIA#360
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: External MCP Tool fields are incorrectly marked as required

2 participants