Repository navigation
Let the linex MCP tools accept null for kernel_filter - #202
Merged
mawad-amd merged 1 commit intoOct 14, 2026
Merged
Conversation
profile_application and analyze_instruction_hotspots annotate kernel_filter as `str = None`, so FastMCP advertises "default": null on a string-only field and rejects a client that sends the default back explicitly. Annotate it `str | None`; the tool bodies already handle None. A test checks that every parameter defaulting to null also accepts null.
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.
profile_applicationandanalyze_instruction_hotspotsdeclarekernel_filter: str = None. FastMCP turns that into{"type": "string", "default": null}, so the schema advertises a default the server then refuses. A client that sends the default back explicitly, for exampleprofile_application(command="./app", kernel_filter=null), gets:Some MCP clients and LLM tool callers fill in every parameter from the schema, so they hit this.
Fix
Annotations only:
kernel_filter: str = None->kernel_filter: str | None = Nonein both tools (1 parameter in each of 2 tools). The schema becomesanyOf: [string, null]withdefault: null, and both tool bodies already passNonethrough toLinex.profile().ruff formatwrapped theanalyze_instruction_hotspotssignature onto one parameter per line because the new annotation pushed it past 100 characters. Nothing else changed.Test
Added
TestToolRegistration::test_null_default_params_accept_nullinlinex/tests/test_mcp_server.py. It lists the registered tools and checks that every parameter whose schema says"default": nullalso acceptsnull. To share the lookup, I split the existing_registered_tools()helper into_registered_tool_objects()plus the name set;_registered_tools()returns the same names as before.profile_application.kernel_filter defaults to null but rejects itfastmcp>=2.0.0)Suite,
pytest linex/testson macOS (no ROCm):The 8 failures are the same on both: every test in
test_inline_hip_sqtt.pyneedshipccand an AMD GPU, so they didn't run here.test_mcp_server.pyis 28/28.ruff checkandruff format --checkpass at the CI version (0.15.22).Not included
metrix/src/metrix/mcp/server.pyhas the same pattern (profile_metrics(metrics: list[str] = None)). I left it out to keep this PR to one package. Open PR Add kernel iteration selection for metrix dispatch filtering #86 already rewrites that signature asOptional[List[str]] = None, so it may not need a separate change.launcher: str = Nonetoprofile_application. That parameter would have the same problem, and the two PRs touch the same signature, so whichever merges second needs a small rebase.