pub struct ComposeReport {Show 16 fields
pub schema_version: String,
pub server_count: usize,
pub total_tools: usize,
pub total_estimated_tokens: usize,
pub total_200_turn_uncached_usd: f32,
pub total_200_turn_cached_usd: f32,
pub combined_score: f32,
pub combined_tier: Tier,
pub cross_server_exact_duplicates: usize,
pub cross_server_semantic_collisions: usize,
pub score_if_namespaced: f32,
pub exact_duplicates_if_namespaced: usize,
pub servers: Vec<ServerTokenShare>,
pub cross_server_collisions: Vec<CrossServerCollision>,
pub deferral_recommendations: Vec<DeferralRecommendation>,
pub combined_audit: AuditReport,
}Expand description
Complete multi-server composition and federation audit report returned by compose_catalogs.
Fields§
§schema_version: StringSchema version.
server_count: usizeNumber of composed MCP servers.
total_tools: usizeTotal tools loaded simultaneously into the agent context.
total_estimated_tokens: usizeTotal estimated serialized prompt tokens across all servers.
total_200_turn_uncached_usd: f32Estimated 200-turn uncached USD cost across all servers.
total_200_turn_cached_usd: f32Estimated 200-turn cached USD cost across all servers.
combined_score: f32Overall quality score of the combined multi-server catalog (1.0–5.0).
combined_tier: TierOverall letter tier of the combined catalog.
cross_server_exact_duplicates: usizeCount of exact duplicate tool names across distinct servers.
cross_server_semantic_collisions: usizeCount of non-exact high-similarity collisions across distinct servers.
score_if_namespaced: f32Simulated overall score if each server’s tools are prefixed with <server>_.
exact_duplicates_if_namespaced: usizeSimulated exact duplicate count after <server>_ namespace prefixing (always 0 for distinct server names).
servers: Vec<ServerTokenShare>Per-server token/cost/quality breakdown sorted descending by estimated_tokens.
cross_server_collisions: Vec<CrossServerCollision>Cross-server collisions sorted exact duplicates first, then descending similarity.
deferral_recommendations: Vec<DeferralRecommendation>Context-budget deferral recommendations when combined tokens exceed config.max_catalog_tokens.
combined_audit: AuditReportFull combined AuditReport across the merged catalog.
Implementations§
Source§impl ComposeReport
impl ComposeReport
Sourcepub fn to_json_pretty(&self) -> Result<String>
pub fn to_json_pretty(&self) -> Result<String>
Serializes this composition report as pretty-printed JSON.
Sourcepub fn to_json_compact(&self) -> Result<String>
pub fn to_json_compact(&self) -> Result<String>
Serializes this composition report as minified single-line JSON for AI agents.
Sourcepub fn to_text(&self) -> String
pub fn to_text(&self) -> String
Formats a concise terminal summary of multi-server token cost and cross-server collisions.
Examples found in repository?
6fn main() {
7 let github = Catalog::from_mcp_json(
8 r#"{
9 "tools": [
10 {
11 "name": "create_issue",
12 "description": "Creates a new GitHub issue in a repository and returns its issue URL.",
13 "inputSchema": {
14 "type": "object",
15 "properties": {
16 "owner": { "type": "string", "description": "Repository owner." },
17 "repo": { "type": "string", "description": "Repository name." },
18 "title": { "type": "string", "description": "Issue title." }
19 },
20 "required": ["owner", "repo", "title"]
21 }
22 },
23 {
24 "name": "search_repositories",
25 "description": "Searches GitHub repositories by keyword and returns a paginated list.",
26 "inputSchema": {
27 "type": "object",
28 "properties": {
29 "query": { "type": "string", "description": "GitHub search query." },
30 "perPage": { "type": "integer", "description": "Results per page." }
31 },
32 "required": ["query"]
33 }
34 }
35 ]
36 }"#,
37 )
38 .expect("valid github catalog");
39
40 let gitlab = Catalog::from_mcp_json(
41 r#"{
42 "tools": [
43 {
44 "name": "create_issue",
45 "description": "Creates a new GitLab issue in a project and returns its issue IID.",
46 "inputSchema": {
47 "type": "object",
48 "properties": {
49 "project_id": { "type": "string", "description": "Project ID or URL-encoded path." },
50 "title": { "type": "string", "description": "Issue title." }
51 },
52 "required": ["project_id", "title"]
53 }
54 },
55 {
56 "name": "list_merge_requests",
57 "description": "Lists open GitLab merge requests for a project with pagination.",
58 "inputSchema": {
59 "type": "object",
60 "properties": {
61 "project_id": { "type": "string", "description": "Project ID." },
62 "limit": { "type": "integer", "description": "Max rows returned." }
63 },
64 "required": ["project_id"]
65 }
66 }
67 ]
68 }"#,
69 )
70 .expect("valid gitlab catalog");
71
72 // 1) Multi-server composition & namespace simulation
73 let composed = compose_catalogs(
74 &[
75 ("github".into(), github.clone()),
76 ("gitlab".into(), gitlab.clone()),
77 ],
78 &AuditConfig::default(),
79 );
80 println!("{}", composed.to_text());
81
82 // 2) Pre-indexed Bm25Index on the namespaced catalog + explainability
83 let mut combined = github.with_namespace_prefix("github").tools().to_vec();
84 combined.extend(
85 gitlab
86 .with_namespace_prefix("gitlab")
87 .tools()
88 .iter()
89 .cloned(),
90 );
91 let namespaced = Catalog::new(combined);
92
93 let index = Bm25Index::build(&namespaced);
94 let hits = index.search("open gitlab merge requests", 2);
95 println!(
96 "Top Bm25Index hit: {} ({:.3})",
97 hits[0].tool_name, hits[0].score
98 );
99
100 let explanation = explain_query(
101 &namespaced,
102 "open gitlab merge requests",
103 Bm25Ranker::default(),
104 2,
105 );
106 println!("{}", explanation.to_text());
107
108 // 3) Side-by-side ranker comparison on an auto-generated adversarial suite
109 let suite = EvalSuite::generate_adversarial(&namespaced);
110 let tfidf = TfIdfRanker::default();
111 let hybrid = HybridRanker::default();
112 let cmp = compare_rankers(
113 &suite,
114 &namespaced,
115 &[("bm25", &index), ("tfidf", &tfidf), ("hybrid", &hybrid)],
116 3,
117 );
118 println!("{}", cmp.to_text());
119}Sourcepub fn to_markdown(&self) -> String
pub fn to_markdown(&self) -> String
Formats a GitHub-Flavored Markdown report suitable for PR comments and architecture reviews.