Support default values in input schema and skip optional properties without defaults#64
Merged
MaestroError merged 5 commits intomainfrom Nov 11, 2025
Merged
Conversation
Co-authored-by: MaestroError <46760939+MaestroError@users.noreply.github.com>
Co-authored-by: MaestroError <46760939+MaestroError@users.noreply.github.com>
Co-authored-by: MaestroError <46760939+MaestroError@users.noreply.github.com>
Co-authored-by: MaestroError <46760939+MaestroError@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for default field in tool property parsing
Support default values in input schema and skip optional properties without defaults
Nov 11, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for default values in tool input schemas and implements conditional property resolution to prevent template substitution errors when optional properties are omitted. The implementation allows tools to define default values for properties that will be used when not provided at execution time, while skipping optional properties without defaults entirely.
Key Changes:
- Added
_resolve_properties_with_defaults()method to handle property resolution with defaults - Updated
execute()to use resolved properties instead of raw input - Modified template context building to use resolved properties for both
propsandinputkeys
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/mcipy/tool_manager.py |
Core logic: Added property resolution method and integrated it into execution flow |
tests/unit/test_tool_manager.py |
Unit tests for property resolution with various edge cases and backward compatibility |
tests/test_default_values_integration.py |
Integration tests demonstrating real-world usage scenarios |
testsManual/test_default_values.py |
Manual test showcasing the feature in action with human-readable output |
docs/schema_reference.md |
Documentation explaining default values behavior with examples |
src/mcipy/mcp_integration.py |
Code formatting fix (import statement split) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tool property parsing ignored the
defaultfield in input schemas and attempted to resolve all schema-defined properties in templates, causing errors when optional properties without defaults were omitted.Changes
Property Resolution Logic
_resolve_properties_with_defaults()method that builds execution context with:Execution Flow
execute()to use resolved properties instead of raw inputExample
{ "inputSchema": { "properties": { "query": { "type": "string" }, "case_sensitive": { "type": "boolean", "default": false }, "max_results": { "type": "number", "default": 100 }, "filter": { "type": "string" } }, "required": ["query"] } }Tests
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
api.example.com/home/REDACTED/work/mci-py/mci-py/.venv/bin/python /home/REDACTED/work/mci-py/mci-py/.venv/bin/pytest(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.