MCPcopy Create free account
hub / github.com/AI45Lab/Code / test_tool_executor_respects_artifact_limits

Function test_tool_executor_respects_artifact_limits

core/src/tools/mod.rs:970–997  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

968
969 #[tokio::test]
970 async fn test_tool_executor_respects_artifact_limits() {
971 let executor = ToolExecutor::new_with_artifact_limits(
972 "/tmp".to_string(),
973 ArtifactStoreLimits {
974 max_artifacts: 1,
975 max_bytes: usize::MAX,
976 },
977 );
978 executor.register_dynamic_tool(Arc::new(LargeArtifactTool));
979
980 let first = executor
981 .execute("large_artifact", &serde_json::json!({}))
982 .await
983 .unwrap();
984 let first_uri = first.metadata.as_ref().unwrap()["artifact"]["artifact_uri"]
985 .as_str()
986 .unwrap()
987 .to_string();
988
989 executor
990 .execute("large_artifact", &serde_json::json!({ "suffix": "again" }))
991 .await
992 .unwrap();
993
994 assert_eq!(executor.artifact_store().limits().max_artifacts, 1);
995 assert_eq!(executor.artifact_store().len(), 1);
996 assert!(executor.get_artifact(&first_uri).is_none());
997 }
998
999 #[tokio::test]
1000 async fn test_tool_executor_register_program_catalog_keeps_script_only_program_tool() {

Callers

nothing calls this directly

Calls 3

register_dynamic_toolMethod · 0.80
executeMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected