Skip to content

Commit c2a4c3b

Browse files
committed
fix: session output
1 parent f2e7777 commit c2a4c3b

File tree

5 files changed

+13
-25
lines changed

5 files changed

+13
-25
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath-mcp"
3-
version = "0.0.36"
3+
version = "0.0.37"
44
description = "UiPath MCP SDK"
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.10"

src/uipath_mcp/_cli/_runtime/_logger.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/uipath_mcp/_cli/_runtime/_runtime.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ async def execute(self) -> Optional[UiPathRuntimeResult]:
120120
# If there are multiple sessions, use the sessionId as the key
121121
output_result = session_outputs
122122

123-
return UiPathRuntimeResult(output=output_result)
123+
self.result = UiPathRuntimeResult(output=output_result)
124+
return self.result
124125

125126
except Exception as e:
126127
if isinstance(e, UiPathMcpRuntimeError):

src/uipath_mcp/_cli/_runtime/_session.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ async def _run_server(self, server_params: StdioServerParameters) -> None:
8787
message = await self.read_stream.receive()
8888
await self.send_outgoing_message(message)
8989
finally:
90-
stderr_temp.seek(0)
91-
self._server_stderr_output = stderr_temp.read()
92-
logger.debug(
93-
f"Session {self.session_id} - Server stderr output:\n{self._server_stderr_output}"
94-
)
9590
# Cancel the consumer when we exit the loop
9691
consumer_task.cancel()
9792
try:
@@ -105,6 +100,11 @@ async def _run_server(self, server_params: StdioServerParameters) -> None:
105100
exc_info=True,
106101
)
107102
finally:
103+
stderr_temp.seek(0)
104+
self._server_stderr_output = stderr_temp.read()
105+
logger.info(
106+
f"Session {self.session_id} - Server stderr output:\n{self._server_stderr_output}"
107+
)
108108
# The context managers will handle cleanup of resources
109109
logger.info(f"Server process for session {self.session_id} has ended")
110110
self.read_stream = None

src/uipath_mcp/_cli/_runtime/_tracer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ def create_span_for_message(self, message: types.JSONRPCMessage, **context) -> S
5353
span.set_attribute("type", "response")
5454
span.set_attribute("span_type", "response")
5555
span.set_attribute("id", str(root_value.id))
56+
if isinstance(root_value.result, dict):
57+
parent_span.set_attribute("output", json.dumps(root_value.result))
5658
self._add_response_attributes(span, root_value)
5759
else: # JSONRPCError
5860
span = self.tracer.start_span("error", context=span_context)
@@ -126,6 +128,9 @@ def _add_request_attributes(
126128
if "arguments" in request.params and isinstance(
127129
request.params["arguments"], dict
128130
):
131+
span.set_attribute(
132+
"input", json.dumps(request.params["arguments"])
133+
)
129134
span.set_attribute(
130135
"tool_args", json.dumps(request.params["arguments"])
131136
)

0 commit comments

Comments
 (0)