Skip to content

fix: remove invalid 'optional' keyword from exec_in_pod schema #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2025

Conversation

anthonysr
Copy link
Contributor

The exec_in_pod tool schema was using 'optional: true' which is not a valid JSON Schema property, causing "strict mode: unknown keyword" errors when starting the MCP server.

In JSON Schema, optional properties are indicated by simply not including them in the 'required' array, not by using an 'optional' keyword.

Changes:

  • Remove 'optional: true' from container, shell, and timeout properties
  • Update corresponding test assertions
  • Maintain same functionality (parameters remain optional)

Fixes Docker container startup error:
"Invalid schema for tool exec_in_pod: strict mode: unknown keyword: "optional""

The exec_in_pod tool schema was using 'optional: true' which is not a
valid JSON Schema property, causing "strict mode: unknown keyword" errors
when starting the MCP server.

In JSON Schema, optional properties are indicated by simply not including
them in the 'required' array, not by using an 'optional' keyword.

Changes:
- Remove 'optional: true' from container, shell, and timeout properties
- Update corresponding test assertions
- Maintain same functionality (parameters remain optional)

Fixes Docker container startup error:
"Invalid schema for tool exec_in_pod: strict mode: unknown keyword: \"optional\""
},
timeout: {
type: "number",
description: "Timeout for command - 60000 milliseconds if not specified",
optional: true,
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we have some default value ? because we want timeout to be optional.

Copy link
Collaborator

Choose a reason for hiding this comment

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

may be you willing to remove only ,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rr-paras-patel the way I understood it, and I could be wrong, was that because it's optional it doesn't have to be defined here.

This PR really is just about making sure the MCP starts up in VSCode w/ Augment without giving errors such as:

Failed to start the MCP server. {"command":"docker run -e HTTPS_PROXY=http://host.docker.internal:3128 -e NO_PROXY=127.0.0.1,localhost -i --rm -v ~/.kube/config:/home/appuser/.kube/config mcp/k8s","args":[],"error":"Invalid schema for tool exec_in_pod: strict mode: unknown keyword: \"optional\"","stderr":"Starting Kubernetes MCP server v0.1.0, handling commands...\n"}

Copy link
Owner

Choose a reason for hiding this comment

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

This looks correct - must have missed it in #155 where the other optional properties were removed. Also, the timeout uses a default value on line 119 already:

const timeoutMs = input.timeout || 60000;

},
timeout: {
type: "number",
description: "Timeout for command - 60000 milliseconds if not specified",
optional: true,
Copy link
Collaborator

Choose a reason for hiding this comment

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

may be you willing to remove only ,

Copy link
Owner

@Flux159 Flux159 left a comment

Choose a reason for hiding this comment

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

LGTM

},
timeout: {
type: "number",
description: "Timeout for command - 60000 milliseconds if not specified",
optional: true,
Copy link
Owner

Choose a reason for hiding this comment

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

This looks correct - must have missed it in #155 where the other optional properties were removed. Also, the timeout uses a default value on line 119 already:

const timeoutMs = input.timeout || 60000;

@Flux159
Copy link
Owner

Flux159 commented Jul 4, 2025

Going to merge this in to get into next release. Thanks @anthonysr!

@Flux159 Flux159 merged commit 32129a8 into Flux159:main Jul 4, 2025
1 check passed
@anthonysr anthonysr deleted the exec_in_pod_optional_true branch July 7, 2025 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants