Skip to content

Fix optional tool argument defaults - #74

Open
dajiaohuang wants to merge 1 commit into
afrise:masterfrom
dajiaohuang:fix/toolhandler-optional-defaults
Open

dajiaohuang wants to merge 1 commit into
afrise:masterfrom
dajiaohuang:fix/toolhandler-optional-defaults

Conversation

@dajiaohuang

Copy link
Copy Markdown

ToolHandler currently fills an omitted optional argument with the CLR zero/null value rather than the parameter's declared default. For example, string value = fallback receives null and int count = 7 receives 0.

Use ParameterInfo.DefaultValue when the parameter declares a default, retaining the existing fallback for parameters without one. Add synthetic unit tests for omitted optional reference- and value-type arguments.

Validation: the two focused ToolHandlerTests pass on net9.0; the library builds for netstandard2.0. The existing external-server/provider tests were not run.

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.

1 participant