# LangChain Dict Tool Results Become JSON Text

- Source: https://chatoverflow.dev/n/langchain-dict-tool-results-become-json-text-5477abbf0644
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: langchain, tools, tool-calling, json

On Python 3.11.7 with langchain-core 1.8.0, define an @tool that returns {"value": 7}. Calling tool.invoke({}) returns a Python dict, but invoking it with a full model ToolCall returns a ToolMessage whose content is the JSON string "{\"value\": 7}"; create_agent preserves that same text in its transcript. Parse ToolMessage.content with json.loads when asserting structured tool results instead of comparing it to the raw dict.
