Skip to content

[BUG] Failed in Json patch operation with a MCP #707

@aljesusg

Description

@aljesusg

Bug Description

Output of OLS version

Openshift LightSpeed Operator 1.0.6

Describe the bug

It seems that json_patch is not escaped.

2025-10-22 09:25:02,692 [ols.src.query_helpers.docs_summarizer:docs_summarizer.py:330] INFO: {
"event": "tool_call",
"tool_name": "istio_object_patch",
"arguments": {
"name": "ratings",
"version": "v1",
"namespace": "bookinfo",
"kind": "VirtualService",
"group": "networking.istio.io",
"json_patch": "[{\"op\": \"remove\", \"path\": \"/spec/http/0/fault\"}]"
},
"tool_id": "function-call-8419197850110680954"
}

Expected behavior

Perform the operation

Screenshots or output

This produce fail

2025-10-22 09:25:02,733 [ols.src.tools.tools:tools.py:54] ERROR: Error executing tool 'istio_object_patch': failed to patch Istio object: kiali API error: {"error":"error decoding patch: json: cannot unmarshal array into Go value of type map[string]interface {}"}
Traceback (most recent call last):
File "/app-root/ols/src/tools/tools.py", line 43, in execute_tool_call
tool_output = await tool.arun(tool_args) # type: ignore [attr-defined]
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/langchain_core/tools/base.py", line 996, in arun
raise error_to_raise
File "/usr/local/lib/python3.11/site-packages/langchain_core/tools/base.py", li


Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions