secops-soar: marketplace tools print() errors to stdout, corrupting the stdio JSON-RPC stream
Same class of bug as #267 (fixed for secops in #315), in secops-soar's generated marketplace tools.
What: secops-soar serves over stdio (await mcp.run_stdio_async() in server.py). The marketplace modules it loads with --integrations (secops_soar_mcp/marketplace/*.py, 295 modules, about 2,100 tools) report errors with bare print(), which writes to stdout. On stdio, stdout is the JSON-RPC stream. Each tool has the same three:
print(f"Error fetching instance for <Integration>: {e}")
print(f"Error executing action <Action> for <Integration>: {e}")
print(f"Warning: No active integration instance found for <Integration>")
For example, marketplace/activedirectory.py lines 99 and 102. The last one runs on a common path: calling a tool for an integration that has no active instance in the SOAR environment. The tool returns {"Status": "Failed", ...} correctly, but the warning line goes out on stdout too, so the client reads a non-JSON line in the protocol stream. Depending on the client, that shows up as parse errors, dropped messages or a closed connection. Python also buffers stdout on a pipe, so the text can land in the middle of a later JSON-RPC frame.
Found by reading the code at c0f34be. I counted roughly 2,100 of each of the three messages across the marketplace directory. I didn't run it against a live SOAR instance.
Possible fix: the server already has logger_utils.get_logger, and server.py logs through it. The marketplace modules look generated (identical structure per integration), so the cleanest fix is probably in the generator: emit logger.error(...) / logger.warning(...) with a module logger instead of print(...). If the generator isn't something you'd change soon, I'm happy to send a PR that makes that same substitution mechanically across marketplace/ (one logger import per module, no other changes). Just say which you'd prefer.
I'd like to take this. I'll do the mechanical marketplace substitution to logger.error / logger.warning (same approach as #315 for secops), unless you'd rather wait on a generator change.