aminghadersohi opened a new pull request, #44572:
URL: https://github.com/apache/superset/pull/44572

   ### SUMMARY
   
   FastMCP parses every registered `@tool` / `@prompt` docstring with 
`griffelib`
   to derive the description and the per-argument descriptions it publishes to 
MCP
   clients. Four `superset/mcp_service/` docstrings are malformed for griffe's
   Google-style parser, so parsing them logs eight `WARNING`s from
   `griffe/_internal/docstrings/utils.py`:
   
   ```
   Failed to get 'name: description' pair from 'None - This tool does not 
accept any parameters'
   No type or annotation for returned value 'HealthCheckResponse'
   No type or annotation for parameter 'model_type'
   No type or annotation for returned value 1
   No type or annotation for parameter 'user_type'
   No type or annotation for parameter 'focus_area'
   No type or annotation for parameter 'chart_type'
   No type or annotation for parameter 'business_goal'
   ```
   
   This is per-process-start, not per-request, so every process that imports the
   MCP service pays it — including workers that never serve MCP traffic. FastMCP
   currently pins the `griffe` logger to `ERROR` at import, so whether the lines
   reach a given deployment's logs depends on that deployment's logging config;
   the malformed docstrings are the defect either way, and they are repaired 
here
   rather than papered over with a log level.
   
   Two of them are not merely noisy:
   
   - **`health_check`** takes no parameters at all, so its `Parameters:` section
     only ever held the prose `None - This tool does not accept any parameters`,
     which is not a `name: description` pair. The sentence directly above it
     ("This tool takes NO parameters") already says this, so the section is
     dropped.
   - **`get_schema`**'s `Args:` documented `model_type`, which is not a 
parameter
     of the function — the signature is `(request: GetSchemaRequest, ctx: 
Context)`.
     FastMCP only injects a docstring description when the name matches a real
     parameter, so that description was silently discarded instead of reaching 
the
     published input schema. It now documents `request`, which keeps the 
original
     sentence and additionally surfaces the accepted `model_type` values to
     clients.
   
   Griffe parses these docstrings standalone, with no parent object to fall back
   to for type information, so the remaining sections spell the type out inline
   (`name (type): description`, `(type): description`) — valid Google style that
   parses cleanly with or without a parent.
   
   To keep this from regressing, a unit test walks every registered tool and
   prompt, asserts that parsing its docstring emits no griffe warning, and 
asserts
   that every documented argument is a real parameter of the function.
   
   **No change to published schemas other than the intended improvement.** 
Dumping
   the MCP tool/prompt schemas before and after shows the prompt argument
   descriptions byte-identical, and the only difference is `get_schema`'s 
`request`
   property description, which grows from `"Request schema for unified 
get_schema
   tool."` to that sentence plus the accepted `model_type` values.
   
   ### TESTING INSTRUCTIONS
   
   ```bash
   pytest tests/unit_tests/mcp_service/test_mcp_docstrings.py
   ```
   
   On `master` the guard fails with the eight warnings above; with this change 
it
   passes. The rest of `tests/unit_tests/mcp_service` is unaffected.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to