MCPcopy Index your code
hub / github.com/AI45Lab/Code / execute

Method execute

core/src/program.rs:715–746  ·  view source on GitHub ↗
(&self, program: &Program)

Source from the content-addressed store, hash-verified

713 }
714
715 pub async fn execute(&self, program: &Program) -> Result<ProgramResult> {
716 let mut steps = Vec::with_capacity(program.steps.len());
717 let mut success = true;
718
719 for step in &program.steps {
720 let result = self
721 .registry
722 .execute_with_context(&step.tool_name, &step.args, &self.context)
723 .await?;
724
725 let step_success = result.exit_code == 0;
726 success &= step_success;
727 steps.push(ProgramStepResult {
728 tool_name: step.tool_name.clone(),
729 label: step.label.clone(),
730 success: step_success,
731 output: result.output,
732 metadata: result.metadata,
733 });
734
735 if !step_success {
736 break;
737 }
738 }
739
740 Ok(ProgramResult {
741 program_name: program.name.clone(),
742 success,
743 summary: summarize_program_result(program, success, steps.len()),
744 steps,
745 })
746 }
747}
748
749pub fn builtin_program_templates() -> Vec<ProgramTemplate> {

Calls 5

summarize_program_resultFunction · 0.85
lenMethod · 0.45
execute_with_contextMethod · 0.45
cloneMethod · 0.45
as_strMethod · 0.45