MCPcopy Index your code
hub / github.com/docker/docker-agent / exportPlanToFile

Method exportPlanToFile

pkg/tools/builtin/plan/plan.go:383–408  ·  view source on GitHub ↗
(ctx context.Context, params ExportPlanToFileArgs)

Source from the content-addressed store, hash-verified

381}
382
383func (t *ToolSet) exportPlanToFile(ctx context.Context, params ExportPlanToFileArgs) (*tools.ToolCallResult, error) {
384 if params.Path == "" {
385 return tools.ResultError("path must not be empty"), nil
386 }
387
388 plan, ok, err := t.storage.Get(ctx, params.Name)
389 if err != nil {
390 return tools.ResultError(err.Error()), nil
391 }
392 if !ok {
393 return tools.ResultError(fmt.Sprintf("plan %q not found", params.Name)), nil
394 }
395
396 if err := writePlanFile(params.Path, plan.Content); err != nil {
397 return tools.ResultError(err.Error()), nil
398 }
399
400 return tools.ResultJSON(ExportResult{
401 Name: params.Name,
402 Path: params.Path,
403 Title: plan.Title,
404 Status: plan.Status,
405 Revision: plan.Revision,
406 BytesWritten: len(plan.Content),
407 }), nil
408}
409
410type SetPlanStatusArgs struct {
411 Name string `json:"name" jsonschema:"The name of the plan whose status to set."`

Implementers 15

StartableToolSetpkg/tools/startable.go
fakeToolSetpkg/tools/named_test.go
stubDescriberpkg/tools/startable_test.go
stubToolSetpkg/tools/startable_test.go
flappyToolSetpkg/tools/startable_test.go
listFlappyToolSetpkg/tools/startable_test.go
reportingToolSetpkg/tools/startable_test.go
reportingStartOnlyToolSetpkg/tools/startable_test.go
recoveryFailingToolSetpkg/tools/startable_test.go
codeModeToolpkg/tools/codemode/codemode.go
testToolSetpkg/tools/codemode/codemode_test.go
Toolsetpkg/tools/a2a/a2a.go

Calls 5

ResultErrorFunction · 0.92
ResultJSONFunction · 0.92
writePlanFileFunction · 0.85
GetMethod · 0.65
ErrorMethod · 0.45