# Exclude tools output from Summary middleware

**URL:** <https://forum.langchain.com/t/exclude-tools-output-from-summary-middleware/2627>\
**Category:** LangChain\
**Tags:** python-help\
**Created:** [December 31, 2025, 9:25am UTC](https://forum.langchain.com/t/exclude-tools-output-from-summary-middleware/2627 "2025-12-31T09:25:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ms-tungtt](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/ms-tungtt/32/2068_2.png) [@ms-tungtt](https://forum.langchain.com/u/ms-tungtt)\
**Post date:** [December 31, 2025, 9:25am UTC](https://forum.langchain.com/t/exclude-tools-output-from-summary-middleware/2627/1 "2025-12-31T09:25:41Z")

</div>

Hi, I’m having an issue when using Summarization middleware with long content (JSON) tools.

After my tool called, the middleware trigger and it summary the messages including the tools data, after that, the middleware

Previous run:

1. Tool calls
2. Generate answer

Next run:

1. Summary including tools data
2. Tool calls again
3. Summary (this step turns the tool call into answer as Human)
4. Model read the summary and judge the summary, not generate answer

How can I exclude the tools data from being summary?

---

<div class="post-metadata">

**Author:** ![pawel-twardziak](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/pawel-twardziak/32/960_2.png) [@pawel-twardziak](https://forum.langchain.com/u/pawel-twardziak)\
**Post date:** [January 2, 2026, 3:24pm UTC](https://forum.langchain.com/t/exclude-tools-output-from-summary-middleware/2627/2 "2026-01-02T15:24:17Z")

</div>

Hi @ms-tungtt

could you share a minimal reproduction example so that I could debug?

---

<div class="post-metadata">

**Author:** ![ms-tungtt](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/ms-tungtt/32/2068_2.png) [@ms-tungtt](https://forum.langchain.com/u/ms-tungtt)\
**Post date:** [January 5, 2026, 4:58am UTC](https://forum.langchain.com/t/exclude-tools-output-from-summary-middleware/2627/3 "2026-01-05T04:58:43Z")

</div>

Hi thank you for reply, unfortunately I don’t have reproduction example but you can check my local thread run here: [LangSmith](https://smith.langchain.com/public/1ff8c9be-78ed-45e6-928a-3ff29a30904c/r)

As you can see the Summarization contains this:

```plaintext
<messages>Messages to summarize:[HumanMessage(content='how to print on demand?', additional_kwargs={}, response_metadata={}, id='634de33d-9f8b-47e0-b294-eb67c7a50615'), AIMessage(content=[], additional_kwargs={'function_call': {'name': 'search_zopi_docs', 'arguments': '{"query": "print on demand pod integration features"}'}, ' __gemini_function_call_thought_signatures__': {'c4922ebc-a3ac-4c13-be88-c795113ae3ab'….

```

and then the final output response is:

```plaintext
That is an excellent summary of Zopi's Print on Demand (POD) features! It highlights the core benefits, from the zero-inventory model to the flexibility of using the Creative Hub for custom designs or the "Get Inspired" libraries for trending ideas.

```

the LLM used the summary as input and answer which is incorrect behavior
