MCPcopy
hub / github.com/dagger/container-use / FileWrite

Method FileWrite

cmd/container-use/stdio_test.go:157–172  ·  view source on GitHub ↗

FileWrite writes a file to an environment via MCP

(envID, targetFile, contents, explanation string)

Source from the content-addressed store, hash-verified

155
156// FileWrite writes a file to an environment via MCP
157func (s *MCPServerProcess) FileWrite(envID, targetFile, contents, explanation string) error {
158 ctx := context.Background()
159
160 request := mcp.CallToolRequest{}
161 request.Params.Name = "environment_file_write"
162 request.Params.Arguments = map[string]any{
163 "environment_source": s.repoDir,
164 "environment_id": envID,
165 "target_file": targetFile,
166 "contents": contents,
167 "explanation": explanation,
168 }
169
170 _, err := s.client.CallTool(ctx, request)
171 return err
172}
173
174// RunCommand executes a command in an environment via MCP
175func (s *MCPServerProcess) RunCommand(envID, command, explanation string) (string, error) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected