MCP tools available via Webhooks returning pretty actions outpu

Hello there!

I am trying to build a workflow involving MCP tools, which:

  1. Accepts REST request with the details.
  2. List tools and executes them.
  3. Returns a nice JSON summary of the performed steps with payloads and comments from LLM.

I succeeded in doing points 1 and 2, but the response from Webhooks is a slightly complicated JSON with tech-specific fields.

Example request:

{
    "request": "create owner Rex; add a pet named Ogar to the newly created owner; choose owner and pet details yourself",
    "sessionId": "9"
}

Example response from webhook:

[
    {
        "output": "I've successfully completed your request. Here's what I did:\n\n1. Created a new owner with the following details:\n   - First Name: Rex\n   - Last Name: Thompson\n   - Address: 567 Aspen Lane\n   - City: Portland\n   - Telephone: 5552345678\n   - The owner was successfully created with ID #11\n\n2. Added a pet named \"Ogar\" to Rex Thompson's profile:\n   - Pet Name: Ogar\n   - Date of Birth: February 15, 2024\n   - Type: Dog (pet type ID: 2)\n   - The pet was successfully added and is now linked to Rex Thompson\n\nRex Thompson is now registered in the system as an owner with a pet dog named Ogar.",
        "intermediateSteps": [
            {
                "action": {
                    "tool": "Petclinic-list-tools",
                    "toolInput": {},
                    "toolCallId": "toolu_vrtx_01L6jBVDamiQYwwSc8LVnFry",
                    "log": "Invoking \"Petclinic-list-tools\" with {}\nI'll help you create a new owner named Rex with a pet named Ogar. Let me check the available tools first and then proceed.",
                    "messageLog": [
                        {
                            "lc": 1,
                            "type": "constructor",
                            "id": [
                                "langchain_core",
                                "messages",
                                "AIMessageChunk"
                            ],
                            "kwargs": {
                                "content": "I'll help you create a new owner named Rex with a pet named Ogar. Let me check the available tools first and then proceed.",
                                "additional_kwargs": {
                                    "tool_calls": [
                                        {
                                            "id": "toolu_vrtx_01L6jBVDamiQYwwSc8LVnFry",
                                            "index": 0,
                                            "type": "function",
                                            "function": {
                                                "name": "Petclinic-list-tools",
                                                "arguments": ""
                                            }
                                        }
                                    ]
                                },
                                "response_metadata": {
                                       <CUT TO LIMIT INPUT SIZE>
                                },
                                "tool_call_chunks": [
                                    {
                                        "name": "Petclinic-list-tools",
                                        "args": "",
                                        "id": "toolu_vrtx_01L6jBVDamiQYwwSc8LVnFry",
                                        "index": 0,
                                        "type": "tool_call_chunk"
                                    }
                                ],
                                "id": "gen-1752494471-88tQzRTS3MoYbixPyYXv",
                                "usage_metadata": {
                                       <CUT TO LIMIT INPUT SIZE>
                                },
                                "tool_calls": [
                                    {
                                        "name": "Petclinic-list-tools",
                                        "args": {},
                                        "id": "toolu_vrtx_01L6jBVDamiQYwwSc8LVnFry",
                                        "type": "tool_call"
                                    }
                                ],
                                "invalid_tool_calls": []
                            }
                        }
                    ]
                },
                "observation": "[{\"tools\":[{\"name\":\"<CUT TO LIMIT INPUT SIZE>"additionalProperties\":false,\"$schema\":\"http://json-schema.org/draft-07/schema#\"}}]}]"
            },
            {
                "action": {
                    "tool": "Petclinic-execute-tool",
                    "toolInput": {
                        "tool": "createOwner",
                        "Tool_Parameters": {
                            "firstName": "Rex",
                            "lastName": "Thompson",
                            "address": "567 Aspen Lane",
                            "city": "Portland",
                            "telephone": "5552345678"
                        }
                    },
                    "toolCallId": "toolu_vrtx_01L3jzb7yKWb31hW5VA8FFh1",
                    "log": "Invoking \"Petclinic-execute-tool\" with {\"tool\":\"createOwner\",\"Tool_Parameters\":{\"firstName\":\"Rex\",\"lastName\":\"Thompson\",\"address\":\"567 Aspen Lane\",\"city\":\"Portland\",\"telephone\":\"5552345678\"}}\nI'll create a new owner named Rex and add a pet named Ogar. First, let me create the owner:",
                    "messageLog": [
                        {
                            "lc": 1,
                            "type": "constructor",
                            "id": [
                                "langchain_core",
                                "messages",
                                "AIMessageChunk"
                            ],
                            "kwargs": {
                                "content": "I'll create a new owner named Rex and add a pet named Ogar. First, let me create the owner:",
                                "additional_kwargs": {
                                    "tool_calls": [
                                        {
                                            "id": "toolu_vrtx_01L3jzb7yKWb31hW5VA8FFh1",
                                            "index": 0,
                                            "type": "function",
                                            "function": {
                                                "name": "Petclinic-execute-tool",
                                                "arguments": "{\"tool\": \"createOwner\", \"Tool_Parameters\": {\"firstName\":\"Rex\",\"lastName\":\"Thompson\",\"address\":\"567 Aspen Lane\",\"city\":\"Portland\",\"telephone\":\"5552345678\"}}"
                                            }
                                        }
                                    ]
                                },
                                "response_metadata": {
                                       <CUT TO LIMIT INPUT SIZE>
                                },
                                "tool_call_chunks": [
                                    {
                                        "name": "Petclinic-execute-tool",
                                        "args": "{\"tool\": \"createOwner\", \"Tool_Parameters\": {\"firstName\":\"Rex\",\"lastName\":\"Thompson\",\"address\":\"567 Aspen Lane\",\"city\":\"Portland\",\"telephone\":\"5552345678\"}}",
                                        "id": "toolu_vrtx_01L3jzb7yKWb31hW5VA8FFh1",
                                        "index": 0,
                                        "type": "tool_call_chunk"
                                    }
                                ],
                                "id": "gen-1752494474-mh0pk9AajFQ0gXkaFgeb",
                                "usage_metadata": {
                                       <CUT TO LIMIT INPUT SIZE>
                                },
                                "tool_calls": [
                                    {
                                        "name": "Petclinic-execute-tool",
                                        "args": {
                                            "tool": "createOwner",
                                            "Tool_Parameters": {
                                                "firstName": "Rex",
                                                "lastName": "Thompson",
                                                "address": "567 Aspen Lane",
                                                "city": "Portland",
                                                "telephone": "5552345678"
                                            }
                                        },
                                        "id": "toolu_vrtx_01L3jzb7yKWb31hW5VA8FFh1",
                                        "type": "tool_call"
                                    }
                                ],
                                "invalid_tool_calls": []
                            }
                        }
                    ]
                },
                "observation": "[{\"result\":{\"content\":[{\"type\":\"text\",\"text\":\"\\\"{\\\\\\\"id\\\\\\\":11,\\\\\\\"message\\\\\\\":\\\\\\\"added successfully\\\\\\\"}\\\"\"}],\"isError\":false}}]"
            },
            {
                "action": {
                    "tool": "Petclinic-execute-tool",
                    "toolInput": {
                        "tool": "listPetTypes",
                        "Tool_Parameters": {
                            "pageNumber": 1
                        }
                    },
                    "toolCallId": "toolu_vrtx_015yBckYAzTEu2xBoywbD3Xs",
                    "log": "Invoking \"Petclinic-execute-tool\" with {\"tool\":\"listPetTypes\",\"Tool_Parameters\":{\"pageNumber\":1}}\n",
                    "messageLog": [
                        {
                            "lc": 1,
                            "type": "constructor",
                            "id": [
                                "langchain_core",
                                "messages",
                                "AIMessageChunk"
                            ],
                            "kwargs": {
                                "content": "",
                                "additional_kwargs": {
                                    "tool_calls": [
                                        {
                                            "id": "toolu_vrtx_015yBckYAzTEu2xBoywbD3Xs",
                                            "index": 0,
                                            "type": "function",
                                            "function": {
                                                "name": "Petclinic-execute-tool",
                                                "arguments": "{\"tool\": \"listPetTypes\", \"Tool_Parameters\": {\"pageNumber\":1}}"
                                            }
                                        }
                                    ]
                                },
                                "response_metadata": {
                                       <CUT TO LIMIT INPUT SIZE>
                                },
                                "tool_call_chunks": [
                                    {
                                        "name": "Petclinic-execute-tool",
                                        "args": "{\"tool\": \"listPetTypes\", \"Tool_Parameters\": {\"pageNumber\":1}}",
                                        "id": "toolu_vrtx_015yBckYAzTEu2xBoywbD3Xs",
                                        "index": 0,
                                        "type": "tool_call_chunk"
                                    }
                                ],
                                "id": "gen-1752494478-v6haS5Rg4A7puENLeOpZ",
                                "usage_metadata": {
                                       <CUT TO LIMIT INPUT SIZE>
                                },
                                "tool_calls": [
                                    {
                                        "name": "Petclinic-execute-tool",
                                        "args": {
                                            "tool": "listPetTypes",
                                            "Tool_Parameters": {
                                                "pageNumber": 1
                                            }
                                        },
                                        "id": "toolu_vrtx_015yBckYAzTEu2xBoywbD3Xs",
                                        "type": "tool_call"
                                    }
                                ],
                                "invalid_tool_calls": []
                            }
                        }
                    ]
                },
                "observation": "[{\"result\":{\"content\<CUT TO LIMIT INPUT SIZE>,\"isError\":false}}]"
            },
            {
                "action": {
                    "tool": "Petclinic-execute-tool",
                    "toolInput": {
                        "tool": "createPet",
                        "Tool_Parameters": {
                            "ownerId": 11,
                            "name": "Ogar",
                            "dateOfBirth": "2024-02-15",
                            "petTypeId": 2
                        }
                    },
                    "toolCallId": "toolu_vrtx_019EhHrmSV8RkP4ZuqZMfKL5",
                    "log": "Invoking \"Petclinic-execute-tool\" with {\"tool\":\"createPet\",\"Tool_Parameters\":{\"ownerId\":11,\"name\":\"Ogar\",\"dateOfBirth\":\"2024-02-15\",\"petTypeId\":2}}\n",
                    "messageLog": [
                        {
                            "lc": 1,
                            "type": "constructor",
                            "id": [
                                "langchain_core",
                                "messages",
                                "AIMessageChunk"
                            ],
                            "kwargs": {
                                "content": "",
                                "additional_kwargs": {
                                    "tool_calls": [
                                        {
                                            "id": "toolu_vrtx_019EhHrmSV8RkP4ZuqZMfKL5",
                                            "index": 0,
                                            "type": "function",
                                            "function": {
                                                "name": "Petclinic-execute-tool",
                                                "arguments": "{\"tool\": \"createPet\", \"Tool_Parameters\": {\"ownerId\":11,\"name\":\"Ogar\",\"dateOfBirth\":\"2024-02-15\",\"petTypeId\":2}}"
                                            }
                                        }
                                    ]
                                },
                                "response_metadata": {
                                       <CUT TO LIMIT INPUT SIZE>
                                },
                                "tool_call_chunks": [
                                    {
                                        "name": "Petclinic-execute-tool",
                                        "args": "{\"tool\": \"createPet\", \"Tool_Parameters\": {\"ownerId\":11,\"name\":\"Ogar\",\"dateOfBirth\":\"2024-02-15\",\"petTypeId\":2}}",
                                        "id": "toolu_vrtx_019EhHrmSV8RkP4ZuqZMfKL5",
                                        "index": 0,
                                        "type": "tool_call_chunk"
                                    }
                                ],
                                "id": "gen-1752494485-0V0uqhAU3MG2KlKJA4Pj",
                                "usage_metadata": {
                                       <CUT TO LIMIT INPUT SIZE>
                                    }
                                },
                                "tool_calls": [
                                    {
                                        "name": "Petclinic-execute-tool",
                                        "args": {
                                            "tool": "createPet",
                                            "Tool_Parameters": {
                                                "ownerId": 11,
                                                "name": "Ogar",
                                                "dateOfBirth": "2024-02-15",
                                                "petTypeId": 2
                                            }
                                        },
                                        "id": "toolu_vrtx_019EhHrmSV8RkP4ZuqZMfKL5",
                                        "type": "tool_call"
                                    }
                                ],
                                "invalid_tool_calls": []
                            }
                        }
                    ]
                },
                "observation": "[{\"result\":{\"content\":[{\"type\":\"text\",\"text\":\"\\\"{\\\\\\\"message\\\\\\\":\\\\\\\"added successfully\\\\\\\"}\\\"\"}],\"isError\":false}}]"
            },
            {
                "action": {
                    "tool": "Petclinic-execute-tool",
                    "toolInput": {
                        "tool": "listOwners",
                        "Tool_Parameters": {
                            "pageNumber": 1,
                            "lastName": "Thompson"
                        }
                    },
                    "toolCallId": "toolu_vrtx_01QK3bwb2rYBcuhEFx8PZXqW",
                    "log": "Invoking \"Petclinic-execute-tool\" with {\"tool\":\"listOwners\",\"Tool_Parameters\":{\"pageNumber\":1,\"lastName\":\"Thompson\"}}\n",
                    "messageLog": [
                        {
                            "lc": 1,
                            "type": "constructor",
                            "id": [
                                "langchain_core",
                                "messages",
                                "AIMessageChunk"
                            ],
                            "kwargs": {
                                "content": "",
                                "additional_kwargs": {
                                    "tool_calls": [
                                        {
                                            "id": "toolu_vrtx_01QK3bwb2rYBcuhEFx8PZXqW",
                                            "index": 0,
                                            "type": "function",
                                            "function": {
                                                "name": "Petclinic-execute-tool",
                                                "arguments": "{\"tool\": \"listOwners\", \"Tool_Parameters\": {\"pageNumber\":1,\"lastName\":\"Thompson\"}}"
                                            }
                                        }
                                    ]
                                },
                                "response_metadata": {
                                       <CUT TO LIMIT INPUT SIZE>
                                    },
                                    "finish_reason": "tool_calls",
                                    "model_name": "anthropic/claude-3.7-sonnet"
                                },
                                "tool_call_chunks": [
                                    {
                                        "name": "Petclinic-execute-tool",
                                        "args": "{\"tool\": \"listOwners\", \"Tool_Parameters\": {\"pageNumber\":1,\"lastName\":\"Thompson\"}}",
                                        "id": "toolu_vrtx_01QK3bwb2rYBcuhEFx8PZXqW",
                                        "index": 0,
                                        "type": "tool_call_chunk"
                                    }
                                ],
                                "id": "gen-1752494488-bJ7QV8UT54X76eNyIu91",
                                "usage_metadata": {
                                       <CUT TO LIMIT INPUT SIZE>
                                },
                                "tool_calls": [
                                    {
                                        "name": "Petclinic-execute-tool",
                                        "args": {
                                            "tool": "listOwners",
                                            "Tool_Parameters": {
                                                "pageNumber": 1,
                                                "lastName": "Thompson"
                                            }
                                        },
                                        "id": "toolu_vrtx_01QK3bwb2rYBcuhEFx8PZXqW",
                                        "type": "tool_call"
                                    }
                                ],
                                "invalid_tool_calls": []
                            }
                        }
                    ]
                },
                "observation": "[{\"result\":{\"content\":[{\"type\"<CUT TO LIMIT INPUT SIZE>\":false}\\\"\"}],\"isError\":false}}]"
            }
        ]
    }
]

I would love to get a JSON summary that would allow me to build a user-friendly summary similar to what Claude Desktop returns:

To be clear - I don’t mean N8N should return a ready to use UI or a 100% ready to use data. Naturally, I see most of the data in the response JSON, however it seems to be really technical and I am afraid of writing parsers/converters depending on some technical details of N8N that would eg. change from version to version.

My questions:

  1. Do you know any ways to get a better structured summary of LLM messages, tool executions etc.?
  2. Are there any docs including info about the output I received from the Webhook?

Here is the workflow I have now: