Skip to content

Commit e21cff5

Browse files
authored
Update utils.py
1 parent e4a83e0 commit e21cff5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mcp_bridge/openai_clients/utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
from mcp_bridge.tool_mappers import mcp2openai
1010

1111

12+
def json_pretty_print(obj) -> str:
13+
if type(obj) == bytes:
14+
obj = obj.decode()
15+
if type(obj) == str:
16+
obj = json.loads(obj)
17+
ret = json.dumps(obj, indent=4, ensure_ascii=False)
18+
return ret
19+
1220
def validate_if_json_object_parsable(content: str):
1321
try:
1422
json.loads(content)

0 commit comments

Comments
 (0)