Add Tool Schema Flatness (TSF) constraint#28
Merged
tylerpayne merged 2 commits intomainfrom Oct 11, 2025
Merged
Conversation
added 2 commits
October 11, 2025 11:14
The "flatness" (i.e. lack of nested structured objects/lists) of a tool's inputSchema can dramatically impact an agent's tool-calling accuracy. This constraint reports a warning if any of your server's tools have nested inputSchemas. See: https://composio.dev/blog/gpt-4-function-calling-example
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds a Tool Schema Flatness (TSF) constraint that validates tool input schemas are "flat" without nested objects or arrays. This constraint aims to improve agent tool-calling accuracy by preventing complex nested structures that can confuse agents.
- Added
ToolInputSchemaFlatnessConstraintclass with comprehensive schema flatness validation - Integrated the constraint into the existing constraint system with CLI support
- Added comprehensive test coverage for various schema patterns including edge cases
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/mcp_interviewer/constraints/tool_schema_flatness.py |
Implements the core constraint logic with nested structure detection and JSON Schema reference resolution |
tests/constraints/test_tool_schema_flatness.py |
Comprehensive test suite covering flat schemas, nested objects, arrays, references, unions, and edge cases |
src/mcp_interviewer/constraints/__init__.py |
Registers the new constraint in the constraint system |
src/mcp_interviewer/cli.py |
Updates CLI help text to include the new TSF constraint code |
pyproject.toml |
Adds required dependencies for jsonschema and pytest |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
The "flatness" (i.e. lack of nested structured objects/lists) of a tool's inputSchema can dramatically impact an agent's tool-calling accuracy.
This constraint reports a warning if any of your server's tools have nested inputSchemas.
See: https://composio.dev/blog/gpt-4-function-calling-example
To check flatness, uses the jsonschema library to parse the inputSchema and check for