mcp-security icon indicating copy to clipboard operation
mcp-security copied to clipboard

Tool parameters typed str = None reject explicit null in scc, secops, and secops-soar marketplace

Open atrearyan opened this issue 3 weeks ago • 1 comments

Summary

#323 fixed this bug in server/gti, but the same bug is still in server/scc, server/secops and the server/secops-soar marketplace modules. These tool parameters default to None while their type annotation excludes None (for example severity: str = None). FastMCP builds the input schema from the annotation, so it advertises {"type": "string", "default": null}. A client that sends that advertised default explicitly is rejected at argument validation, before the tool body runs. Some agent frameworks fill every optional field with null, so they hit this.

Noted as a pre-existing issue in #347.

Reproduction

These calls used an in-memory MCP client on main at bc045e2 with mcp 1.30.0. Each passed only the argument shown as null (plus any required arguments):

scc        search_findings(severity=None)
           schema: {"default": null, "title": "Severity", "type": "string"}
           Error executing tool search_findings: 1 validation error for search_findingsArguments
           severity
             Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]

secops     search_udm(project_id=None)
           schema: {"default": null, "title": "Project Id", "type": "string"}
           project_id
             Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]

secops-soar (CSV marketplace)  csv_save_json_to_csv(overwrite=None)
           schema: {"default": null, ..., "title": "Overwrite", "type": "boolean"}
           Error executing tool csv_save_json_to_csv: 1 validation error for csv_save_json_to_csvArguments
           overwrite
             Input should be a valid boolean [type=bool_type, input_value=None, input_type=NoneType]

Callers that omit the argument are not affected.

Affected parameters

  • server/scc/scc_mcp.py: 30 parameters across 6 tools:

    • search_findings
    • get_finding_details
    • search_findings_by_compliance
    • top_vulnerability_findings
    • get_finding_remediation
    • set_finding_mute

    The _build_parent helper has the same annotations but is not a tool.

  • server/secops/secops_mcp/tools/: 10 parameters across 4 tools:

    • search_udm: project_id, customer_id, region
    • export_udm_search_csv: project_id, customer_id, region
    • find_udm_field_values: project_id, customer_id, region
    • update_feed: feed_details: dict[str, Any] = None
  • server/secops-soar/secops_soar_mcp/marketplace/: 3,310 parameters across 946 tools in 214 of the 294 modules. They all follow the pattern Annotated[bool, Field(default=None, ...)] (or str, list[str], and so on). These modules are generated outside this repo, so the lasting fix belongs in the generator.

Proposed fix

Annotate these parameters as nullable. The packages target Python 3.11 since #347, so the PEP 604 form fits:

severity: str | None = None
overwrite: Annotated[bool | None, Field(default=None, description="...")]

The schema then becomes anyOf: [{"type": X}, {"type": "null"}]. Behavior does not change for callers that omit the argument, since None is already the default each tool body handles.

For tests, port test_none_default_params_accept_null from server/gti/tests/test_tools.py (added in #323) to each package. It fails if any tool advertises "default": null on a type that excludes null. It would fail on main today and pass after the fix.

I'm happy to send this as separate PRs per package (scc, secops, and the marketplace generator output). #300 also touches server/scc/scc_mcp.py, so the scc change may need a rebase around it.

atrearyan avatar Nov 12 '26 04:11 atrearyan

Fix in #351 .

Hi @dandye , Fixed in three per-package commits: scc (30 params, 6 tools), secops (10 params, 4 tools) and the secops-soar marketplace (3,310 params, 946 tools). Parameters that default to None are now typed X | None, so an explicit null is accepted and behaves the same as omitting the argument.

Each package gets the test_none_default_params_accept_null check from #323 plus one end-to-end null call. Every tool's input schema was compared before and after: only these parameters changed, from type: X to anyOf: [X, null], and output schemas and descriptions are unchanged.

The marketplace modules are generated outside this repo, so the generator needs the same change or a regeneration will bring the bug back.

atrearyan avatar Nov 13 '26 00:11 atrearyan