Repository navigation
Conversation
…t default to None Closes google#349
FastMCP decodes a string argument that holds a JSON object or array
whenever the parameter is not annotated exactly `str`. After the
`str | None` change, '{"field": "value"}' sent to a parameter such as
arcsight additional_fields arrived as a dict and failed string
validation.
Marketplace `str | None` parameters now use OptionalStr, which encodes
a decoded object or array back to JSON text. The advertised schema is
unchanged.
Contributor
Author
|
Hi @dandye , Follow-up comment: with the |
This branch has not been 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.
Summary
Tool parameters that default to
Nonebut are typed with a non-nullable annotation (for exampleseverity: str = None) advertise{"type": "string", "default": null}. A client that sends that advertised default explicitly is rejected at argument validation, before the tool runs. This applies the fix from #323 (gti) to the remaining packages: these parameters are now typedX | None, so an explicit null is accepted and behaves the same as omitting the argument.Closes #349
Changes
The work is split into one commit per package:
scc_mcp.py. The_build_parenthelper gets the same 2-parameter change so its types match the tools that call it.search_udm,export_udm_search_csvandfind_udm_field_values:project_id,customer_id,regionupdate_feed:feed_detailsAnnotated[T, Field(default=None, ...)]becomesAnnotated[T | None, Field(default=None, ...)]. The edit is mechanical: the only change on every modified line is the added| None.Tool docstrings are unchanged.
Tests
test_none_default_params_accept_null, ported fromserver/gti(fix(gti): accept explicit null for parameters that default to None #323), is added to each package. It fails if any tool advertises"default": nullon a type that excludes null. Each package also gets one end-to-end call that passesnulland checks it behaves like omitting the argument:search_findings(severity=None)search_udm(project_id=None, ...)csv_save_json_to_csv(overwrite=None)mainwith the validation error from Tool parameters typed str = None reject explicit null in scc, secops, and secops-soar marketplace #349 and pass with this change.tests/config.jsonwith credentials; none of them exercise the changed code.tests/unit: 13 passed.Schema check
I dumped every tool's
list_tools()output before and after the change: 6 scc tools, 70 secops tools and 2,123 marketplace tools. Exactly 30, 10 and 3,310 input properties changed, each fromtype: XtoanyOf: [X, {type: null}], withdefault,titleanddescriptionunchanged. No other property, output schema or tool description changed.Notes
search_findingsandsearch_findings_by_compliancedocstrings in scc say to setstateto None to search all states, butstate: str = "ACTIVE"rejects an explicit null. I can follow up separately if that should accept null too.server/scc/scc_mcp.py, but none of the lines changed here.Closes #349