-
Notifications
You must be signed in to change notification settings - Fork 23
feat: add infra diagnostics tool to the Moose Dev MCP #2915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add infra diagnostics tool to the Moose Dev MCP #2915
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Test Inconsistency with New Tool Addition
The test cases test_list_tools_count() and test_tool_names_are_consistent() are incomplete after adding the diagnose_infrastructure tool. The tests only verify 5 tools, but the list_tools() method now returns 6 tools (including the new infra_issues::tool_definition() at line 86). The test at line 212 asserts all_tools.len() == 5 but should be 6, and the expected_tools array at line 226 is missing the "diagnose_infrastructure" tool that is now returned by list_tools().
apps/framework-cli/src/mcp/server.rs#L203-L243
moosestack/apps/framework-cli/src/mcp/server.rs
Lines 203 to 243 in d002009
| #[test] | |
| fn test_list_tools_count() { | |
| // Test that all expected tools are returned | |
| let logs_tool = logs::tool_definition(); | |
| let infra_tool = infra_map::tool_definition(); | |
| let olap_tool = query_olap::tool_definition(); | |
| let stream_tool = sample_stream::tool_definition(); | |
| let get_source_tool = get_source::tool_definition(); | |
| // Ensure we have 5 tools | |
| let all_tools = vec![ | |
| &logs_tool, | |
| &infra_tool, | |
| &olap_tool, | |
| &stream_tool, | |
| &get_source_tool, | |
| ]; | |
| assert_eq!(all_tools.len(), 5); | |
| // Verify each tool has required fields | |
| for tool in all_tools { | |
| assert!(!tool.name.is_empty()); | |
| assert!(tool.description.is_some()); | |
| assert!(!tool.input_schema.is_empty()); | |
| } | |
| } | |
| #[test] | |
| fn test_tool_names_are_consistent() { | |
| // Ensure tool names match between routing and definitions | |
| let expected_tools = [ | |
| "get_logs", | |
| "get_infra_map", | |
| "query_olap", | |
| "get_stream_sample", | |
| "get_source", | |
| ]; | |
| let logs_tool = logs::tool_definition(); | |
| let infra_tool = infra_map::tool_definition(); | |
| let olap_tool = query_olap::tool_definition(); |
|
can you explain a bit the tools added and how they interact, perhaps with an example use case? actually, just pasting the output of a session with tool calls would be illuminating |
|
@onelesd Did you take a look at the issue? there is a bunch of context there |
d002009 to
360a8eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Test Fails to Validate New Tool Consistency
The test_tool_names_are_consistent test has an expected_tools array with only 5 tool names, missing "diagnose_infrastructure", and doesn't instantiate or check the infra_issues::tool_definition(). This causes the test to not validate the newly added tool's name consistency with the routing logic in call_tool.
apps/framework-cli/src/mcp/server.rs#L253-L272
moosestack/apps/framework-cli/src/mcp/server.rs
Lines 253 to 272 in 360a8eb
| #[test] | |
| fn test_tool_names_are_consistent() { | |
| // Ensure tool names match between routing and definitions | |
| let expected_tools = [ | |
| "get_logs", | |
| "get_infra_map", | |
| "query_olap", | |
| "get_stream_sample", | |
| "get_source", | |
| ]; | |
| let logs_tool = logs::tool_definition(); | |
| let infra_tool = infra_map::tool_definition(); | |
| let olap_tool = query_olap::tool_definition(); | |
| let stream_tool = sample_stream::tool_definition(); | |
| let get_source_tool = get_source::tool_definition(); | |
| assert_eq!(logs_tool.name, expected_tools[0]); | |
| assert_eq!(infra_tool.name, expected_tools[1]); | |
| assert_eq!(olap_tool.name, expected_tools[2]); |
360a8eb to
528f791
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Test fails to validate all tools.
The test test_list_tools_count only validates 5 tool definitions but list_tools() now returns 6 tools including the newly added infra_issues tool. The test's comment claims to verify "all expected tools" but omits infra_issues_tool, leaving that tool's definition untested.
apps/framework-cli/src/mcp/server.rs#L232-L250
moosestack/apps/framework-cli/src/mcp/server.rs
Lines 232 to 250 in 205dbc8
| let stream_tool = sample_stream::tool_definition(); | |
| let get_source_tool = get_source::tool_definition(); | |
| // Ensure we have 5 tools | |
| let all_tools = vec![ | |
| &logs_tool, | |
| &infra_tool, | |
| &olap_tool, | |
| &stream_tool, | |
| &get_source_tool, | |
| ]; | |
| assert_eq!(all_tools.len(), 5); | |
| // Verify each tool has required fields | |
| for tool in all_tools { | |
| assert!(!tool.name.is_empty()); | |
| assert!(tool.description.is_some()); | |
| assert!(!tool.input_schema.is_empty()); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Tool Count Test: Expectation vs. Reality
The test_list_tools_count test checks only 5 tools but list_tools() now returns 6 tools including the new infra_issues::tool_definition(). The test doesn't include infra_issues_tool in the count verification, causing the test to assert an incorrect tool count that doesn't match the actual implementation.
apps/framework-cli/src/mcp/server.rs#L226-L248
moosestack/apps/framework-cli/src/mcp/server.rs
Lines 226 to 248 in ebe61ae
| #[test] | |
| fn test_list_tools_count() { | |
| // Test that all expected tools are returned | |
| let logs_tool = logs::tool_definition(); | |
| let infra_tool = infra_map::tool_definition(); | |
| let olap_tool = query_olap::tool_definition(); | |
| let stream_tool = sample_stream::tool_definition(); | |
| let get_source_tool = get_source::tool_definition(); | |
| // Ensure we have 5 tools | |
| let all_tools = vec![ | |
| &logs_tool, | |
| &infra_tool, | |
| &olap_tool, | |
| &stream_tool, | |
| &get_source_tool, | |
| ]; | |
| assert_eq!(all_tools.len(), 5); | |
| // Verify each tool has required fields | |
| for tool in all_tools { | |
| assert!(!tool.name.is_empty()); | |
| assert!(tool.description.is_some()); |
LucioFranco
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, looking forward to giving this a try and improving on this! This is a really great start and I am quite happy because I think what is in here aligns really well with what we've been talking about!
685e3c0 to
7c40c36
Compare
Note
Adds a new MCP tool
diagnose_infrastructurewith multiple ClickHouse diagnostics and wires it into the server alongside tests and docs updates.diagnose_infrastructureinlist_toolsand routes incall_tool.infra_issues(ClickHouse diagnostics):infra_issues/mod.rswith params parsing, severity filtering, Redis-backed infra map usage, and aggregated JSON output with summaries.MutationDiagnostic(system.mutations): stuck/failed mutations.PartsDiagnostic(system.parts): excessive parts per partition.MergeDiagnostic(system.merges): long-running merges.ErrorStatsDiagnostic(system.errors): top recurring errors (system-wide).S3QueueDiagnostic(system.s3queue_log): ingestion failures (S3Queue tables).ReplicationDiagnostic(system.replication_queue/system.replicas): lag and health issues (replicated tables).MergeFailureDiagnostic(system.metrics): background merge failures (system-wide).StoppedOperationsDiagnostic: merges/replication possibly stopped.infra_issuesintools/mod.rs.get_source.rs: remove unusedSourceLocationNotAvailableerror variant.Written by Cursor Bugbot for commit 7c40c36. This will update automatically on new commits. Configure here.