IssueTriage can now interact with task in YouTrack and it is idempotent

This commit is contained in:
2026-09-20 20:56:36 +03:00
parent 74577cb50e
commit f25d9a5fab
34 changed files with 1834 additions and 201 deletions
+24 -2
View File
@@ -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()