capabilities
Tasks capability checking utilities.
This module provides functions for checking and requiring task-related capabilities. All tasks capability logic is centralized here to keep the main session code clean.
WARNING: These APIs are experimental and may change without notice.
check_tasks_capability
check_tasks_capability(
required: ClientTasksCapability,
client: ClientTasksCapability,
) -> bool
Check if client's tasks capability matches the required capability.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
required
|
ClientTasksCapability
|
The capability being checked for |
required |
client
|
ClientTasksCapability
|
The client's declared capabilities |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if client has the required capability, False otherwise |
Source code in src/mcp/shared/experimental/tasks/capabilities.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
has_task_augmented_elicitation
has_task_augmented_elicitation(
caps: ClientCapabilities,
) -> bool
Check if capabilities include task-augmented elicitation support.
Source code in src/mcp/shared/experimental/tasks/capabilities.py
51 52 53 54 55 56 57 58 59 | |
has_task_augmented_sampling
has_task_augmented_sampling(
caps: ClientCapabilities,
) -> bool
Check if capabilities include task-augmented sampling support.
Source code in src/mcp/shared/experimental/tasks/capabilities.py
62 63 64 65 66 67 68 69 70 | |
require_task_augmented_elicitation
require_task_augmented_elicitation(
client_caps: ClientCapabilities | None,
) -> None
Raise MCPError if client doesn't support task-augmented elicitation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client_caps
|
ClientCapabilities | None
|
The client's declared capabilities, or None if not initialized |
required |
Raises:
| Type | Description |
|---|---|
MCPError
|
If client doesn't support task-augmented elicitation |
Source code in src/mcp/shared/experimental/tasks/capabilities.py
73 74 75 76 77 78 79 80 81 82 83 | |
require_task_augmented_sampling
require_task_augmented_sampling(
client_caps: ClientCapabilities | None,
) -> None
Raise MCPError if client doesn't support task-augmented sampling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client_caps
|
ClientCapabilities | None
|
The client's declared capabilities, or None if not initialized |
required |
Raises:
| Type | Description |
|---|---|
MCPError
|
If client doesn't support task-augmented sampling |
Source code in src/mcp/shared/experimental/tasks/capabilities.py
86 87 88 89 90 91 92 93 94 95 96 | |