File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1354,10 +1354,7 @@ async def _tool_call(
13541354 "ToolException from LangChain should not be raised in tool.func"
13551355 )
13561356
1357- # TODO: Should we change the splunklib.ai.tools.ToolResult.content to a str, instead of list[str]?
1358- text_content = "\n " .join (result .content )
1359-
1360- artifact = ToolResult (text_content , result .structured_content )
1357+ artifact = ToolResult (result .content , result .structured_content )
13611358
13621359 if result .structured_content :
13631360 # For both local tools and remote tools (Splunk MCP Server App), the primary
@@ -1371,7 +1368,7 @@ async def _tool_call(
13711368 # this assumption may need to be revisited. For now, this approach is fine.
13721369 # Worst-case scenario is the same information is provided to the LLM twice.
13731370 return asdict (result ), artifact # both content + structured_content
1374- return text_content , artifact
1371+ return result . content , artifact
13751372
13761373 return StructuredTool (
13771374 name = _normalize_tool_name (tool .name , tool .type ),
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ class ToolException(Exception):
4040
4141@dataclass (frozen = True )
4242class ToolResult :
43- content : list [ str ]
43+ content : str
4444 structured_content : dict [str , Any ] | None
4545
4646
@@ -243,7 +243,7 @@ def _convert_tool_result(
243243 text_contents .append (content .text )
244244
245245 return ToolResult (
246- content = text_contents , structured_content = result .structuredContent
246+ content = " \n " . join ( text_contents ) , structured_content = result .structuredContent
247247 )
248248
249249
Original file line number Diff line number Diff line change 77
88
99async def no_op () -> ToolResult :
10- return ToolResult (content = [] , structured_content = {})
10+ return ToolResult (content = "" , structured_content = {})
1111
1212
1313LOCAL_TOOL_1 = Tool (
You can’t perform that action at this time.
0 commit comments