MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / Execute

Method Execute

tools/builtin.go:133–143  ·  view source on GitHub ↗
(_ context.Context, execCtx ExecutionContext, input any)

Source from the content-addressed store, hash-verified

131}
132
133func (t *WriteFileTool) Execute(_ context.Context, execCtx ExecutionContext, input any) (string, error) {
134 in := deref[WriteFileInput](input)
135 path := resolveToolPath(execCtx, in.FilePath)
136 if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
137 return fmt.Sprintf("Error writing file: %s", err), nil
138 }
139 if err := os.WriteFile(path, []byte(in.Content), 0o644); err != nil {
140 return fmt.Sprintf("Error writing file: %s", err), nil
141 }
142 return fmt.Sprintf("File written successfully: %s (%d characters)", path, len([]rune(in.Content))), nil
143}
144
145type EditFileInput struct {
146 FilePath string `json:"file_path" jsonschema_description:"The absolute path to the file to edit"`

Callers

nothing calls this directly

Calls 1

resolveToolPathFunction · 0.85

Tested by

no test coverage detected