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

   ### SUMMARY
   Reading the `instance://metadata` MCP resource always fails. 
`InstanceInfo.feature_availability` is a required field (added in #37964), but 
the resource builds its `InstanceInfoCore` without a `feature_availability` 
metric calculator, so the response never validates and the resource returns the 
`{"error": "Unable to fetch complete metadata", ...}` fallback instead of 
instance stats and the available dataset/database IDs. The failure is 
deterministic, not data-dependent:
   
   ```
   Error generating instance metadata: 1 validation error for InstanceInfo
   feature_availability
     Field required [type=missing]
   ```
   
   Only the `get_instance_info` tool was updated in #37964. This PR moves the 
metric calculator map (and time windows) into `system_utils` as 
`INSTANCE_INFO_METRIC_CALCULATORS` / `INSTANCE_INFO_TIME_WINDOWS` and uses them 
from both the tool and the resource, so a future required `InstanceInfo` field 
only has to be wired once.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   N/A
   
   ### TESTING INSTRUCTIONS
   ```
   pytest tests/unit_tests/mcp_service/system 
tests/unit_tests/mcp_service/test_mcp_tool_registration.py
   ```
   The new 
`tests/unit_tests/mcp_service/system/resources/test_instance_metadata.py` reads 
`instance://metadata` through the MCP client, asserts there is no `error` key, 
that the payload validates against `InstanceInfo` (including 
`feature_availability`), and that `available_datasets` / `available_databases` 
are populated. It also asserts the tool and resource share the same calculator 
map. Both tests fail on `master` and pass with this change.
   
   To verify manually, read the `instance://metadata` resource from an MCP 
client and confirm it returns `feature_availability`, `available_datasets` and 
`available_databases` rather than the fallback error payload.
   
   ### 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
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] 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