MCPcopy Index your code
hub / github.com/coder/coder / ProposePlan

Function ProposePlan

coderd/x/chatd/chattool/proposeplan.go:31–67  ·  view source on GitHub ↗

ProposePlan returns a tool that presents a Markdown plan file from the workspace for user review.

(options ProposePlanOptions)

Source from the content-addressed store, hash-verified

29// ProposePlan returns a tool that presents a Markdown plan file from the
30// workspace for user review.
31func ProposePlan(options ProposePlanOptions) fantasy.AgentTool {
32 return fantasy.NewAgentTool(
33 "propose_plan",
34 "Present a Markdown plan file from the workspace for user review. "+
35 "The file must already exist with a .md extension. Use write_file to create it or edit_files to refine it before calling this tool. "+
36 "Pass the absolute file path to the plan. Important: use the chat-specific absolute plan path, not a generic path like PLAN.md in the home directory. "+
37 "The tool reads the content from the workspace.",
38 func(ctx context.Context, args ProposePlanArgs, _ fantasy.ToolCall) (fantasy.ToolResponse, error) {
39 if options.IsPlanTurn {
40 planPath, err := resolvePlanTurnPath(ctx, options.ResolvePlanPath)
41 if err != nil {
42 return fantasy.NewTextErrorResponse(err.Error()), nil
43 }
44 path := strings.TrimSpace(args.Path)
45 switch {
46 case path == "":
47 args.Path = planPath
48 case path != planPath:
49 return fantasy.NewTextErrorResponse("during plan turns, propose_plan path must be " + planPath), nil
50 default:
51 args.Path = path
52 }
53 }
54 if options.GetWorkspaceConn == nil {
55 return fantasy.NewTextErrorResponse("workspace connection resolver is not configured"), nil
56 }
57 if options.StoreFile == nil {
58 return fantasy.NewTextErrorResponse("file storage is not configured"), nil
59 }
60 conn, err := options.GetWorkspaceConn(ctx)
61 if err != nil {
62 return fantasy.NewTextErrorResponse(err.Error()), nil
63 }
64 return executeProposePlanTool(ctx, conn, args, options.ResolvePlanPath, options.StoreFile)
65 },
66 )
67}
68
69func executeProposePlanTool(
70 ctx context.Context,

Callers 3

appendRootChatToolsMethod · 0.92
TestProposePlanFunction · 0.92

Calls 3

resolvePlanTurnPathFunction · 0.85
executeProposePlanToolFunction · 0.85
ErrorMethod · 0.45

Tested by 2

TestProposePlanFunction · 0.74