Skip to content

Conversation

@dandye
Copy link
Collaborator

@dandye dandye commented Aug 22, 2025

This fixes some of the issues reported in #148

The List[Any] type hints are still a problem so the functions in this module that also have that issue remain broken.
The TargetEntity change does fix google_chronicle_get_rule_details for example (b/c it does not use List[Any])

Here is gemini's explanation of the issue:

Fix FastMCP tool registration issues with TargetEntity type

Changed target_entities parameter type from List[TargetEntity] to List[Dict[str, str]] across all tool definitions. FastMCP's schema generator cannot properly resolve Pydantic model types in tool parameters, causing tools to be skipped during registration with "missing types in parameter schema" errors. This issue persists even when defining the model locally within the same module.

The simpler Dict[str, str] type uses only built-in Python types that FastMCP can reliably serialize into its parameter schema. Inside each tool function, we now convert the dictionaries back to TargetEntity objects using target_entities = [TargetEntity(**entity) for entity in target_entities] to maintain type safety and compatibility with the rest of the codebase.

This change ensures all tools are properly registered while preserving the existing business logic and type validation.


@dandye dandye requested a review from a team August 22, 2025 02:40
@googleSandy
Copy link

googleSandy commented Aug 22, 2025

I asked Gemini CLI the difference in versioning (why it worked with a prior version and not the most recent/stable):

The issue is the type hint for the case_priority parameter. It's using CasePriority, which is a custom
type, likely an Enum. The new, stricter Gemini CLI requires that all tool parameter types be standard
types that can be represented in a JSON schema (like str, int, bool, list, dict). The tool loader
doesn't know how to convert the custom CasePriority type into a standard type for the OpenAPI
specification.

This is the root of the problem. The new Gemini CLI's tool validator doesn't automatically convert this
StrEnum into a format that's valid for the OpenAPI schema that it uses to register the tools. All the
other tools that are failing are likely using similar custom types.

The Fix
The developers of the secops-soar MCP will need to update the function signature in case_management.py.
The case_priority parameter should be type-hinted as a standard str, and the validation and conversion
to the CasePriority enum should happen inside the function.

I have updated the change_case_priority decorator to:

    @mcp.tool()
    async def change_case_priority(
        case_id: Annotated[str, Field(..., description="The ID of the case.")],
        case_priority: Annotated[
            str,
            Field(
                ...,
                description="The priority of the case.",
            ),
        ],

This tool now shows up under the secops-soar MCP tools list.

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.

2 participants