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

Method updatePlanFromFile

pkg/tools/builtin/plan/plan.go:350–376  ·  view source on GitHub ↗
(ctx context.Context, params UpdatePlanFromFileArgs)

Source from the content-addressed store, hash-verified

348}
349
350func (t *ToolSet) updatePlanFromFile(ctx context.Context, params UpdatePlanFromFileArgs) (*tools.ToolCallResult, error) {
351 if params.Path == "" {
352 return tools.ResultError("path must not be empty"), nil
353 }
354
355 content, err := readPlanFile(params.Path)
356 if err != nil {
357 return tools.ResultError(err.Error()), nil
358 }
359 if content == "" {
360 return tools.ResultError("file is empty; plan content must not be empty"), nil
361 }
362
363 plan, err := t.storage.Upsert(ctx, UpsertRequest{
364 Name: params.Name,
365 Content: &content,
366 Title: optStr(params.Title),
367 Author: optStr(params.Author),
368 Status: optStr(params.Status),
369 ExpectedRevision: params.LastKnownRevision,
370 })
371 if err != nil {
372 return tools.ResultError(err.Error()), nil
373 }
374
375 return tools.ResultJSON(plan), nil
376}
377
378type ExportPlanToFileArgs struct {
379 Name string `json:"name" jsonschema:"The name of the plan to export."`

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 6

ResultErrorFunction · 0.92
ResultJSONFunction · 0.92
readPlanFileFunction · 0.85
optStrFunction · 0.85
UpsertMethod · 0.65
ErrorMethod · 0.45