Skip to content

Commit b05c64b

Browse files
Simplify call_control_plane_api response format for LLM consumers (#7)
Flatten the wrapper object so LLMs no longer confuse metadata with the actual API response body. Replace success/status_code/data keys with http_status_code and raw_response on all HTTP response paths while keeping tool-level error paths unchanged. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5e50f90 commit b05c64b

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

control_plane_openapi_mcp/tools.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -308,16 +308,14 @@ def call_control_plane_api(path: str) -> str:
308308
try:
309309
response_data = response.json()
310310
return json.dumps({
311-
"success": True,
312-
"status_code": response.status_code,
313-
"data": response_data
311+
"http_status_code": response.status_code,
312+
"raw_response": response_data
314313
}, indent=2)
315314
except ValueError:
316315
# Response is not JSON
317316
return json.dumps({
318-
"success": True,
319-
"status_code": response.status_code,
320-
"data": response.text
317+
"http_status_code": response.status_code,
318+
"raw_response": response.text
321319
}, indent=2)
322320
else:
323321
# Handle error responses
@@ -327,10 +325,8 @@ def call_control_plane_api(path: str) -> str:
327325
error_data = response.text
328326

329327
return json.dumps({
330-
"success": False,
331-
"status_code": response.status_code,
332-
"error": error_data,
333-
"path": path
328+
"http_status_code": response.status_code,
329+
"raw_response": error_data
334330
}, indent=2)
335331

336332
except Exception as e:

0 commit comments

Comments
 (0)