Prerequisites
Toolbox version
us-central1-docker.pkg.dev/database-toolbox/toolbox/toolbox:latest
Environment
No response
Client
No response
Expected Behavior
When an HTTP REST tool receives a 201 status code from an API endpoint, it should be treated as a successful response, as 201 indicates a resource was successfully created.
Current Behavior
MCP Toolbox throws a ToolError when receiving HTTP 201 responses:
ToolError: unexpected status code: 201, response body: {"created_at": null, "url": "https://www.dummytest.com/api/action/",
"test": "https://www.dummytest.com/api/device/xxxxx/"}
Steps to reproduce?
1.Configure an HTTP REST tool in tools.yaml that calls a POST endpoint
2.The API endpoint returns HTTP 201 with a valid response body showing the created resource
3.MCP Toolbox treats this as an error instead of success
Additional Details
https://github.com/googleapis/genai-toolbox/blob/main/internal/tools/http/http.go
Looks like anything other than 200 is considered as error
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("unexpected status code: %d, response body: %s", resp.StatusCode, string(body))
}
No response
Prerequisites
Toolbox version
us-central1-docker.pkg.dev/database-toolbox/toolbox/toolbox:latest
Environment
No response
Client
No response
Expected Behavior
When an HTTP REST tool receives a 201 status code from an API endpoint, it should be treated as a successful response, as 201 indicates a resource was successfully created.
Current Behavior
MCP Toolbox throws a ToolError when receiving HTTP 201 responses:
ToolError: unexpected status code: 201, response body: {"created_at": null, "url": "https://www.dummytest.com/api/action/",
"test": "https://www.dummytest.com/api/device/xxxxx/"}
Steps to reproduce?
1.Configure an HTTP REST tool in tools.yaml that calls a POST endpoint
2.The API endpoint returns HTTP 201 with a valid response body showing the created resource
3.MCP Toolbox treats this as an error instead of success
Additional Details
https://github.com/googleapis/genai-toolbox/blob/main/internal/tools/http/http.go
Looks like anything other than 200 is considered as error
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("unexpected status code: %d, response body: %s", resp.StatusCode, string(body))
}
No response