Repository navigation
Conversation
Replace typing.List/Dict/Optional/Union with built-in generics and
X | Y unions, and catch the builtin TimeoutError (asyncio.TimeoutError
is an alias of it on Python 3.11+).
Tool return annotations whose outermost type is typing.Dict stay
typing.Dict with `# noqa: UP006`. FastMCP builds an unwrapped
DictOutput schema only for built-in dict[...], so rewriting them would
drop the {"result": ...} wrapper from outputSchema and structuredContent
on 12 tools and remove outputSchema from get_collection_mitre_tree. A
new test pins the wrapped schema for those tools.
Also add python_requires=">=3.11" to setup.py and 3.12-3.14
classifiers to pyproject.toml.
Replace typing.List/Dict/Tuple/Optional/Union with built-in generics and X | Y unions, and drop typing imports left unused. Tool return annotations whose outermost type is typing.Dict stay typing.Dict with `# noqa: UP006` (and `# noqa: UP035` on the import), because FastMCP builds an unwrapped DictOutput schema only for built-in dict[...]. Rewriting them would change outputSchema and structuredContent on 44 tools. Also add python_requires=">=3.11" to setup.py and 3.12-3.14 classifiers to pyproject.toml.
Use built-in dict[...] in the non-tool helper and drop the unused
typing.List import. The six tool return annotations stay typing.Dict
with `# noqa: UP006` (and `# noqa: UP035` on the import) to keep
FastMCP's {"result": ...} outputSchema unchanged.
Also add python_requires=">=3.11" to setup.py and 3.12-3.14
classifiers to pyproject.toml.
Replace typing.List/Dict/Type/Optional with built-in generics and X | None in the core modules, utils, and tests, and drop typing imports left unused. The generated marketplace modules are handled in a separate commit. Also add python_requires=">=3.11" to setup.py and 3.12-3.14 classifiers to pyproject.toml.
…odules Replace typing.List/Dict/Optional/Union with built-in generics and X | Y unions across the 294 generated marketplace integration modules, and drop the typing imports left unused (only Annotated remains). The change is mechanical and reproducible with `ruff check --target-version py311 --select UP006,UP007,UP035,UP045 --fix` plus removing the unused names from each `from typing import` line. These modules are generated outside this repository, so the generator should emit the same syntax or a regeneration will bring the legacy aliases back.
Replace typing.List/Dict/Optional with built-in generics and X | None across the agent, CLI, server routes, config, and sample servers and agents, and drop typing imports left unused. Annotate the AgentSettings model validator with typing.Self instead of a string forward reference. Raise the typer floor to >=0.12.4: earlier typer releases fail with "RuntimeError: Type not yet supported: str | None" on the CLI's X | None parameters.
… ADK import placement Annotate the HttpClient get/post/patch params and req arguments as dict[str, Any] | None instead of relying on an implicit Optional default, and move the collections.abc import added in the ADK commit next to the other collections import. No runtime or schema change.
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
Modernizes the codebase to Python >=3.11 typing syntax as described in #344: PEP 585 built-in generics, PEP 604
X | Yunions,typing.Selfwhere it applies, and consistentpython_requires/ classifiers.The issue suggests one PR per package. This PR keeps that split as one commit per package, so it can be reviewed commit by commit, and I'm happy to break it into separate PRs if you prefer:
server/gtiserver/secopsserver/sccserver/secops-soar(core)server/secops-soar/secops_soar_mcp/marketplace(generated)run-with-google-adkOne deliberate exception:
typing.Dicton tool return annotationsFastMCP (mcp 1.10 through 1.30) only builds an unwrapped
<tool>DictOutputschema when a tool's return annotation is a built-indict[...](types.GenericAlias).typing.Dict[str, X]takes a different path and gets the wrapped{"result": ...}schema, and baredictgets nooutputSchemaat all. Converting these annotations would therefore changeoutputSchemaand the shape ofstructuredContentreturned to clients for 62 tools (12 gti, 44 secops, 6 scc), and removeoutputSchemafromget_collection_mitre_tree.To keep schemas unchanged, those 62 return annotations stay
typing.Dictwith# noqa: UP006 - typing.Dict keeps FastMCP {"result": ...} outputSchema(plus# noqa: UP035on the matching import). Everything else is converted. A new gti test pins the wrapped schema so a futureruff --fixcannot silently change it. Upstream python-sdk is changing this check for mcp 2.x, so these markers should be removed together with an mcp 2.x upgrade.Other changes
server/gti:except (asyncio.TimeoutError, TimeoutError)becomesexcept TimeoutError(they are the same class on 3.11+).run-with-google-adk: the settings validator returnstyping.Self; thetyperfloor is raised to>=0.12.4, because earlier versions cannot build CLI commands withX | Noneparameters.python_requires=">=3.11"added to the foursetup.pyfiles, and 3.12/3.13/3.14 classifiers added to the four serverpyproject.tomlfiles.from __future__ import annotationswas added anywhere, and nullable tool parameters keepX | None = None.Testing
list_tools()output (inputSchema,outputSchema, descriptions) was compared before and after: byte-identical for all 2,258 tools (gti 36, secops 70, scc 6, SOAR core 17, marketplace 2,123, ADK sample servers 6).call_tool()round-trips with mocked backends return identicalstructuredContent, including explicitnullarguments.tests/config.json, unchanged frommain.list_tools()andcall_tool()matchedmain.AgentSettingsJSON schema are identical before and after.Notes for reviewers
ruff check --isolated --target-version py311 --select UP006,UP007,UP035,UP045 --fixplus removing the unused names from eachfrom typing importline. The marketplace modules are generated outside this repo, so the generator should be updated to match.Optional[str]/List[str]were left unchanged, because they become the tool descriptions clients see.datetime.timezone.utctodatetime.UTC(21 places). Bugs that already exist onmain, which I can open separately:str = None(scc, a few secops tools, and the marketplace) reject an explicitnull, as fixed for gti in fix(gti): accept explicit null for parameters that default to None #323.--integrationsloader cannot import the four marketplace modules with dots in their filenames.setup.py), refactor(servers): replace wildcard imports with explicit exports and enforce tool import checks in CI #328 (secopsserver.pyimports), and feat(secops): add SIEM dashboard MCP tools (native, scheduled reports, Content Hub, legacy Looker and SOAR) #331 (secopsutils.py).Closes #344