Skip to content

Commit e5c6971

Browse files
- Amended test.
1 parent 323cca3 commit e5c6971

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

test/robot/functional/mcp.robot

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,12 @@ Start MCP Servers
5858

5959
Parse 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 ***

0 commit comments

Comments
 (0)