feat(mcp): #30 add every_tool and does_not_accept for catalog-wide tool assertions#31
Merged
Merged
Conversation
|
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.



Closes #30.
Summary
AssertableToolList.every_tool(callback)— applies the callback to every tool in the list. Useful for catalog-wide invariants (auth scopes, feature flags) without enumerating every tool name. Skips non-dict entries silently, consistent with existingcontains_tool/does_not_contain_tool.AssertableToolDef.does_not_accept(params)— asserts that the named params are NOT exposed ininputSchema.properties(covers both required and optional). Single inverse instead of the two proposed in the issue — see the issue comment for rationale.Both methods follow the module's existing conventions (
raise AssertionError, tool name in messages, defensive against missinginputSchema/properties).Scope note
The issue proposed
does_not_accept_optional. After discussion we settled ondoes_not_accept(single method, semantically cleaner). Comment on the issue explains why.Test plan
every_tool: applies callback to each, propagates assertion errors with tool name, passes silently on empty list, skips non-dicts, returns Self for chaining.does_not_accept: passes when params absent, passes when no inputSchema, raises with tool name and offending properties when present, returns Self for chaining.