IssueTriage can now interact with task in YouTrack and it is idempotent
This commit is contained in:
@@ -63,7 +63,25 @@ class YouTrackMCPClient:
|
||||
logger.debug("MCP CALL: %s with %s", name, arguments)
|
||||
result = await self._call_tool_or_raise(name, arguments)
|
||||
logger.debug("MCP RAW RESULT: %s", repr(result)[:500])
|
||||
return result.structured_content or result.content
|
||||
if result.structured_content is not None:
|
||||
return result.structured_content
|
||||
|
||||
# Convert content blocks to JSON-serializable form
|
||||
if result.content:
|
||||
out = []
|
||||
for block in result.content:
|
||||
if getattr(block, "type", None) == "text":
|
||||
out.append({"type": "text", "text": block.text})
|
||||
else:
|
||||
# fallback for other block types
|
||||
out.append({"type": getattr(block, "type", "unknown"),
|
||||
"data": str(block)})
|
||||
# If it's a single text block, unwrap to plain string
|
||||
if len(out) == 1 and out[0]["type"] == "text":
|
||||
return out[0]["text"]
|
||||
return out
|
||||
|
||||
return None
|
||||
|
||||
async def _call_tool_or_raise(self, name: str, arguments: dict):
|
||||
try:
|
||||
@@ -87,4 +105,8 @@ class YouTrackMCPClient:
|
||||
raise IssueNotFound(text)
|
||||
raise RuntimeError(f"MCP tool {name} failed: {text}")
|
||||
|
||||
return result
|
||||
return result
|
||||
|
||||
async def list_tools(self):
|
||||
"""List all available tools from the MCP server."""
|
||||
return await self._client.list_tools()
|
||||
Reference in New Issue
Block a user