46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
"""TaskGetTool — retrieve full details of a single task.
|
|
|
|
Returns the complete task record including description, timestamps,
|
|
and dependency information.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any, ClassVar
|
|
|
|
from ..base import Tool, ToolParameter, ToolResult
|
|
from .task_storage import TaskStorage
|
|
|
|
|
|
class TaskGetTool(Tool):
|
|
"""Get full details of a task by ID."""
|
|
|
|
name: ClassVar[str] = "task_get"
|
|
description: ClassVar[str] = (
|
|
"Retrieve full task details including description, status, "
|
|
"dependencies, and timestamps."
|
|
)
|
|
parameters: ClassVar[list[ToolParameter]] = [
|
|
ToolParameter(
|
|
name="task_id",
|
|
type="string",
|
|
description="The task ID to retrieve (e.g. 'task-1')",
|
|
),
|
|
ToolParameter(
|
|
name="conversation_id",
|
|
type="string",
|
|
description="Conversation scope for task storage",
|
|
),
|
|
]
|
|
|
|
async def execute(self, **kwargs: Any) -> ToolResult:
|
|
conversation_id: str = kwargs["conversation_id"]
|
|
task_id: str = kwargs["task_id"]
|
|
|
|
storage = TaskStorage(conversation_id)
|
|
task = storage.get(task_id)
|
|
|
|
if task is None:
|
|
return ToolResult.fail(f"Task not found: {task_id}")
|
|
|
|
return ToolResult.success(task)
|