File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ use eb_stack:: mcp:: handle_message;
2+ use serde_json:: json;
3+
4+ #[ test]
5+ fn mcp_catalog_matches_the_version_one_workflows ( ) {
6+ let response = handle_message ( & json ! ( {
7+ "jsonrpc" : "2.0" ,
8+ "id" : 1 ,
9+ "method" : "tools/list" ,
10+ "params" : { }
11+ } ) )
12+ . expect ( "tools/list response" ) ;
13+ let names = response[ "result" ] [ "tools" ]
14+ . as_array ( )
15+ . expect ( "tool array" )
16+ . iter ( )
17+ . filter_map ( |tool| tool[ "name" ] . as_str ( ) )
18+ . collect :: < Vec < _ > > ( ) ;
19+ for expected in [
20+ "eb_package_inspect" ,
21+ "eb_package_plan" ,
22+ "eb_package_bump" ,
23+ "eb_recipe_check" ,
24+ "eb_recipe_format" ,
25+ "eb_stack_solve" ,
26+ "eb_target_list" ,
27+ "eb_target_doctor" ,
28+ "eb_campaign_run" ,
29+ "eb_campaign_status" ,
30+ ] {
31+ assert ! ( names. contains( & expected) , "missing {expected}: {names:?}" ) ;
32+ }
33+ for removed in [
34+ "eb_ingest" ,
35+ "eb_plan" ,
36+ "eb_bump" ,
37+ "eb_solve" ,
38+ "eb_check_recipe" ,
39+ ] {
40+ assert ! ( !names. contains( & removed) , "legacy tool remains: {names:?}" ) ;
41+ }
42+ }
43+
44+ #[ test]
45+ fn mcp_target_doctor_uses_layered_public_config ( ) {
46+ let temp = tempfile:: tempdir ( ) . expect ( "tempdir" ) ;
47+ let config = temp. path ( ) . join ( "targets.toml" ) ;
48+ std:: fs:: write (
49+ & config,
50+ r#"
51+ schema_version = 1
52+ [[targets]]
53+ name = "local-doctor"
54+ [targets.transport]
55+ kind = "local"
56+ [targets.executor]
57+ kind = "direct"
58+ [targets.runtime]
59+ kind = "host"
60+ [targets.easybuild]
61+ command = "true"
62+ robot_paths = ["/tmp"]
63+ work_root = "/tmp"
64+ tmp_root = "/tmp"
65+ "# ,
66+ )
67+ . expect ( "config" ) ;
68+ let response = handle_message ( & json ! ( {
69+ "jsonrpc" : "2.0" ,
70+ "id" : 2 ,
71+ "method" : "tools/call" ,
72+ "params" : {
73+ "name" : "eb_target_doctor" ,
74+ "arguments" : {
75+ "configs" : [ config] ,
76+ "target" : "local-doctor"
77+ }
78+ }
79+ } ) )
80+ . expect ( "doctor response" ) ;
81+ assert_eq ! ( response[ "result" ] [ "isError" ] , false , "{response}" ) ;
82+ let body = response[ "result" ] [ "structuredContent" ] . clone ( ) ;
83+ assert_eq ! ( body[ "target" ] , "local-doctor" ) ;
84+ assert_eq ! ( body[ "ok" ] , true ) ;
85+ }
You can’t perform that action at this time.
0 commit comments