RunCommand executes a command in an environment via MCP
(envID, command, explanation string)
| 173 | |
| 174 | // RunCommand executes a command in an environment via MCP |
| 175 | func (s *MCPServerProcess) RunCommand(envID, command, explanation string) (string, error) { |
| 176 | ctx := context.Background() |
| 177 | |
| 178 | request := mcp.CallToolRequest{} |
| 179 | request.Params.Name = "environment_run_cmd" |
| 180 | request.Params.Arguments = map[string]any{ |
| 181 | "environment_source": s.repoDir, |
| 182 | "environment_id": envID, |
| 183 | "command": command, |
| 184 | "explanation": explanation, |
| 185 | } |
| 186 | |
| 187 | result, err := s.client.CallTool(ctx, request) |
| 188 | if err != nil { |
| 189 | return "", err |
| 190 | } |
| 191 | |
| 192 | if len(result.Content) > 0 { |
| 193 | if textContent, ok := result.Content[0].(mcp.TextContent); ok { |
| 194 | return textContent.Text, nil |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | return "", nil |
| 199 | } |
| 200 | |
| 201 | // createMCPServerForRepositoryTest creates an MCP server process for repository contention testing |
| 202 | func createMCPServerForRepositoryTest(t *testing.T, i int, repoDir, configDir string, singleTenant bool) *MCPServerProcess { |
no outgoing calls
no test coverage detected