Repository navigation
Python: Reject tool call arguments for parameters with include_in_function_choices=False - #14774
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit intoNov 10, 2026
Conversation
…ction_choices=False Kernel.invoke_function_call now accepts only the parameters that were advertised to the model. A tool call that names a parameter hidden with include_in_function_choices=False gets the existing unexpected-argument result and the function is not invoked. Hidden parameters keep getting their value from the invocation-level arguments or their default.
Eduard van Valkenburg (eavanvalkenburg)
requested a review
from a team
as a code owner
November 10, 2026 10:01
Eduard van Valkenburg (eavanvalkenburg)
deployed
to
github-app-auth
November 10, 2026 10:01 — with
GitHub Actions
Active
Copilot started reviewing on behalf of
Eduard van Valkenburg (eavanvalkenburg)
November 10, 2026 10:01
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the change rejecting model-supplied arguments for hidden parameters.
No open issues 🎉
What changed in this PR
This PR aligns Python auto function calling with tool schemas by rejecting model-supplied arguments for parameters marked include_in_function_choices=False. It complements #14625, which excluded these parameters from additional providers’ tool schemas.
Changes:
- Reject hidden parameter names through the existing unexpected-argument response.
- Document that hidden values come from invocation-level arguments or parameter defaults.
- Add tests for rejection of dict and JSON-string arguments and preservation of host-supplied values.
| File | Description |
|---|---|
python/tests/unit/kernel/test_kernel.py |
Adds hidden-parameter rejection and host-value preservation tests. |
python/semantic_kernel/kernel.py |
Restricts accepted model arguments to visible parameters. |
python/semantic_kernel/functions/kernel_function_decorator.py |
Documents hidden-parameter handling during auto function calling. |
Review effort: Balanced
Eduard van Valkenburg (eavanvalkenburg)
enabled auto-merge
November 10, 2026 10:03
Darren Cohen (dargilco)
approved these changes
Nov 10, 2026
Eduard van Valkenburg (eavanvalkenburg)
deleted the
python-reject-hidden-parameter-tool-args
branch
November 10, 2026 16:48
This branch was successfully deployed
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.
Motivation and Context
Parameters declared with
{"include_in_function_choices": False}are left out of the tool schema that is sent to the model, and the docs describe them as values the host supplies throughKernelArguments.Kernel.invoke_function_callstill accepted those names in a model tool call, so a value from the model took precedence over the invocation-level value.This change makes argument handling match the schema: a tool call can only set the parameters that were advertised to the model. It is the counterpart of #14625, which stopped advertising these parameters in the Anthropic, Bedrock, Google AI and Vertex AI tool formats. There is no related open issue.
Description
Kernel.invoke_function_callbuilds the set of accepted argument names from the parameters that haveinclude_in_function_choices=True. A tool call that includes a hidden parameter gets the existing "Received unexpected argument(s)" result and the function is not invoked, so the model can retry without it.KernelArgumentsor from their default. The required-parameter check is unchanged.kernel_functiondocstring now states that a tool call from the model cannot set such a parameter.tests/unit/kernel/test_kernel.pycover a hidden name in dict and JSON-string arguments (the function must not run and the result must be the unexpected-argument message) and a host-supplied hidden value that still reaches the function. The two rejection tests fail without the change.Compatibility: Bedrock agents create their function schema server-side when the action group is created, so action groups created before #14625 (released in python 1.46.0) still list hidden parameters. Calls from such agents that include a hidden name now get the unexpected-argument result until the action group is re-created.
Validation, run on Python 3.13 (macOS) in an environment built like the unit-test workflow (
uv pip install --editable ".[<all extras>]" --group dev), frompython/unless noted:uv run --no-sync python -u -X faulthandler -m pytest -p no:cacheprovider -n auto ./tests/unit --ignore=tests/unit/processes/dapr_runtime: 4983 passed, 1 skipped, 5 xfailed. The dapr suite was not run locally.uv run --no-sync pytest -p no:cacheprovider tests/unit/kernel/test_kernel.py -k hidden_parameter: 3 passed.uv run --no-sync pre-commit run --config python/.pre-commit-config.yaml --files <the three changed files>(from the repo root): all hooks passed or had no files to check.uv run --no-sync mypy -p semantic_kernel --config-file mypy.ini: 42 errors in 7 files, none in the changed files. Unmodifiedmainreports the same total (42 errors in 7 files) in this environment.Contribution Checklist