Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions packages/uipath/src/uipath/agent/models/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,22 @@ def datafabric_entity_identifiers(self) -> list[str]:
return []


class McpToolTaskSupport(str, CaseInsensitiveEnum):
"""Whether an MCP tool may be invoked as a task (MCP 2025-11-25 ``execution.taskSupport``)."""

FORBIDDEN = "forbidden"
OPTIONAL = "optional"
REQUIRED = "required"


class AgentMcpToolExecution(BaseCfg):
"""Execution metadata for an MCP tool, mirroring the MCP tool's ``execution`` object."""

task_support: McpToolTaskSupport = Field(
default=McpToolTaskSupport.FORBIDDEN, alias="taskSupport"
)
Comment on lines +468 to +470


class AgentMcpTool(BaseCfg):
"""Agent MCP tool model."""

Expand All @@ -464,6 +480,9 @@ class AgentMcpTool(BaseCfg):
argument_properties: Dict[str, AgentToolArgumentProperties] = Field(
{}, alias="argumentProperties"
)
# MCP 2025-11-25 task support, when the snapshot/server provides it. Absent for older
# snapshots, in which case the tool is treated as not task-augmentable.
execution: Optional[AgentMcpToolExecution] = Field(None, alias="execution")


class DynamicToolsMode(str, CaseInsensitiveEnum):
Expand Down
26 changes: 26 additions & 0 deletions packages/uipath/tests/agent/models/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
AgentIxpExtractionResourceConfig,
AgentIxpVsEscalationResourceConfig,
AgentMcpResourceConfig,
AgentMcpTool,
AgentMessageRole,
AgentNumberOperator,
AgentNumberRule,
Expand All @@ -52,6 +53,7 @@
BatchTransformWebSearchGrounding,
CitationMode,
DeepRagFileExtension,
McpToolTaskSupport,
StandardRecipient,
TaskTitleType,
TextBuilderTaskTitle,
Expand Down Expand Up @@ -2034,6 +2036,30 @@ def test_mcp_resource_with_output_schema(self):
assert tool2.output_schema is not None
assert "content" in tool2.output_schema["properties"]

def test_mcp_tool_parses_execution_task_support(self):
"""AgentMcpTool carries the MCP execution.taskSupport signal when present."""
tool = AgentMcpTool.model_validate(
{
"name": "invoke-process",
"description": "Run a long-running process",
"inputSchema": {"type": "object", "properties": {}},
"execution": {"taskSupport": "optional"},
}
)
assert tool.execution is not None
assert tool.execution.task_support == McpToolTaskSupport.OPTIONAL

def test_mcp_tool_without_execution_defaults_to_none(self):
"""Older snapshots without execution leave it unset (treated as not task-augmentable)."""
tool = AgentMcpTool.model_validate(
{
"name": "echo",
"description": "Echo",
"inputSchema": {"type": "object", "properties": {}},
}
)
assert tool.execution is None

@pytest.mark.parametrize(
"recipient_type_int,value,expected_type",
[
Expand Down
Loading