File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -58,15 +58,12 @@ Start MCP Servers
5858
5959Parse MCP JSON Output
6060 [Arguments] ${stdout }
61- ${lines } = Split To Lines ${stdout }
62- ${json_lines } = Create List
63- FOR ${l } IN @{lines }
64- ${trim } = Strip String ${l }
65- Run Keyword If "${trim } " != "" and "${trim } "[0 ]=="{" and "${trim } "[-1 ]=="}" Append To List ${json_lines } ${trim }
66- END
67- Should Not Be Empty ${json_lines }
68- ${last } = Set Variable ${json_lines } [-1 ]
69- ${parsed } = Evaluate __import__("json").loads(r'''${last } ''')
61+ ${raw } = Set Variable ${stdout }
62+ ${start } = Evaluate r'''${raw } '''.find('{')
63+ ${end } = Evaluate r'''${raw } '''.rfind('}')
64+ Run Keyword If ${start } == -1 or ${end } == -1 Fail Could not locate JSON braces in output
65+ ${fragment } = Evaluate r'''${raw } '''[${start } :${end } +1 ]
66+ ${parsed } = Evaluate json.loads(r'''${fragment } ''') json
7067 [Return] ${parsed }
7168
7269*** Settings ***
You can’t perform that action at this time.
0 commit comments