Skip to content

Commit 7b1dbbd

Browse files
authored
Added guard for empty region (#1423)
1 parent 78a8cb0 commit 7b1dbbd

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/pkg/mcp/prompts/awsBYOC.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@ func setupAWSBYOPrompt(s *server.MCPServer, cluster string, providerId *client.P
6666
}
6767

6868
region := getStringArg(req.Params.Arguments, "AWS_REGION", "")
69-
err = os.Setenv("AWS_REGION", region)
70-
if err != nil {
71-
return nil, err
69+
if region != "" {
70+
err = os.Setenv("AWS_REGION", region)
71+
if err != nil {
72+
return nil, err
73+
}
7274
}
7375
}
7476

src/pkg/mcp/tools/estimate.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,6 @@ func setupEstimateTool(s *server.MCPServer, cluster string, providerId *cliClien
4747
term.Debug("Estimate tool called")
4848
track.Evt("MCP Estimate Tool")
4949

50-
if *providerId == cliClient.ProviderDefang || *providerId == cliClient.ProviderAuto {
51-
// We only support estimates for AWS and GCP, not playground; suggest use setup prompt for another provider
52-
err := errors.New("estimates are only supported for AWS and GCP; please configure another provider using the appropriate prompts and type /mcp.defang.AWS_Setup for AWS or /mcp.defang.GCP_Setup for GCP")
53-
return mcp.NewToolResultErrorFromErr("No compatible provider configured", err), err
54-
}
55-
5650
wd, err := request.RequireString("working_directory")
5751
if err != nil || wd == "" {
5852
term.Error("Invalid working directory", "error", errors.New("working_directory is required"))

0 commit comments

Comments
 (0)