наблюдаемость: измерять бюджет каталога MCP
CI / Rust Checks (push) Successful in 12m5s
CI / UI Checks (push) Successful in 9s
CI / Deployment Manifests (push) Successful in 6s
CI / Frontend E2E (push) Failing after 30s
CI / Deploy (push) Has been skipped

This commit is contained in:
2026-07-21 01:59:09 +03:00
parent 0241d186ea
commit 63f8ee333f
10 changed files with 284 additions and 4 deletions
@@ -1,6 +1,6 @@
use std::collections::BTreeMap;
use crank_community_mcp::manifest::tool_definitions;
use crank_community_mcp::manifest::{analyze_published_tool_catalog, tool_definitions};
use crank_core::{
ExecutionConfig, HttpMethod, Operation, OperationId, OperationSecurityLevel, OperationStatus,
Protocol, RestTarget, Target, ToolDescription, WorkspaceId,
@@ -57,6 +57,20 @@ fn marks_destructive_tools_as_two_step_confirmation_calls() {
assert_eq!(definition["inputSchema"]["required"], json!(["base"]));
}
#[test]
fn catalog_budget_uses_the_same_definitions_as_tools_list() {
let tool = published_tool();
let definitions = tool_definitions(&tool);
let analysis = analyze_published_tool_catalog(&[tool]).unwrap();
assert_eq!(analysis.budget.tool_count, definitions.len());
assert_eq!(
analysis.budget.serialized_bytes,
serde_json::to_vec(&definitions[0]).unwrap().len()
);
assert!(!analysis.budget.exceeds_recommended_budget);
}
fn published_tool() -> PublishedAgentTool {
PublishedAgentTool {
workspace_id: WorkspaceId::new("ws_01"),