Skip to content

Commit e3dce0d

Browse files
committed
Clarify distinction between statusMessage and error fields
1 parent 60620cd commit e3dce0d

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

docs/specification/draft/basic/utilities/tasks.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,9 +659,11 @@ A task represents the execution state of a request. The task metadata includes:
659659

660660
- `taskId`: Unique identifier for the task
661661
- `status`: Current state of the task execution
662+
- `statusMessage`: Optional human-readable message describing the current state (can be present for any status)
662663
- `createdAt`: ISO 8601 timestamp when the task was created
663664
- `ttl`: Time in milliseconds from creation before task may be deleted
664665
- `pollInterval`: Suggested time in milliseconds between status checks
666+
- `error`: Error details when status is `failed` (should only be present for failed tasks)
665667

666668
### Task Status
667669

@@ -787,6 +789,11 @@ Receivers are not obligated to retain task metadata indefinitely. It is complian
787789

788790
When the underlying request does not complete successfully, the task moves to the `failed` status. This includes JSON-RPC protocol errors during request execution, or for tool calls specifically, when the tool result has `isError` set to true. The `tasks/get` response **SHOULD** include an `error` field with details about the failure.
789791

792+
The `error` field is distinct from `statusMessage`:
793+
794+
- `error`: Provides diagnostic information about what went wrong (only present when `status` is `failed`)
795+
- `statusMessage`: Provides optional human-readable context for any task status (e.g., cancellation reasons, completion summaries)
796+
790797
**Example: Task with execution error**
791798

792799
```json

docs/specification/draft/schema.mdx

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

schema/draft/schema.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

schema/draft/schema.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,9 @@ export interface Task {
12181218
status: TaskStatus;
12191219

12201220
/**
1221-
* Current task state message, optional.
1221+
* Optional human-readable message describing the current task state.
1222+
* This can provide context for any status (e.g., reasons for "cancelled",
1223+
* summaries for "completed", etc.).
12221224
*/
12231225
statusMessage?: string;
12241226

@@ -1238,7 +1240,9 @@ export interface Task {
12381240
pollInterval?: number;
12391241

12401242
/**
1241-
* Error message if status is "failed".
1243+
* Error details when status is "failed".
1244+
* This field provides diagnostic information about what went wrong and should only
1245+
* be present when the task has failed. Use statusMessage for general state descriptions.
12421246
*/
12431247
error?: string;
12441248
}

0 commit comments

Comments
 (0)