Tool Name: Not defined in the current tool contract
Risk Level: Read
Execution Mode: Synchronous
Category: Device Management
Quick Start (Copy & Use)
Summary: Read a paginated, per-device snapshot for an application uninstall task.
Prerequisites: Positive integer HistoryId returned by Uninstall Application.
Success Criteria: Succeeded == true and ErrorMessage is empty. This confirms a valid result page, but devices may still be Processing.
What to Do Next: Read later pages when Pagination.page_index < Pagination.last_page; poll PageIndex 1 while Counts.processing_count is nonzero.
Minimal Request Example:
{
"HistoryId": 710245,
"PageIndex": 1,
"PageSize": 20
}
Minimal Response Example:
{
"HistoryId": 710245,
"Counts": {"target_count": 1, "processing_count": 1, "succeeded_count": 0, "failed_count": 0},
"Results": [{"device": {"device_id": "a8f3d91c72b44e5fa103c892d0b74561", "name": "Warehouse Tablet 01", "group_id": 4103, "model": "DT200", "platform": "Android", "online": "Online"}, "status": "Processing", "failure_reason": null, "updated_at": null}],
"Pagination": {"total": 1, "page_size": 20, "page_index": 1, "last_page": 1},
"Succeeded": true,
"ErrorCode": "",
"Hint": "",
"Retryable": false,
"OriginalStatusCode": 200,
"StatusCode": 200,
"ErrorMessage": ""
}
Recipes (Common Recipes)
Recipe 1: First Result Page
When to use: Immediately after Uninstall Application returns an accepted HistoryId.
{
"HistoryId": 710245,
"PageIndex": 1,
"PageSize": 20
}
Recipe 2: Next Page
When to use: The first response has page_index < last_page.
{
"HistoryId": 710245,
"PageIndex": 2,
"PageSize": 20
}
Recipe 3: Poll Active Devices
When to use: Counts.processing_count is greater than zero.
{
"HistoryId": 710245,
"PageIndex": 1,
"PageSize": 20
}
The contract's polling guidance is to read page 1 after 5 seconds, then after 10, 20, and 30 seconds; stop when processing_count is zero or after 10 minutes.
1. Overview
1.1 Description
Reads per-device application uninstall results for one accepted task with explicit pagination.
1.2 When to Use
- Track device-side completion after Uninstall Application.
- Identify Failed rows and their failure_reason.
- Read every result page for a large active-device snapshot.
1.3 Execution Mode and Response
This is a synchronous, idempotent read. Succeeded=true means a valid page was returned, not that every device succeeded. Counts and Results are active-device snapshots and can change while devices report progress.
1.4 Prerequisites
| Condition | Description |
|---|---|
| Accepted task | Use a positive HistoryId returned by Uninstall Application. |
| Valid pagination | PageIndex >= 1; PageSize is 1-100. |
1.5 Prerequisite Tools
| Tool | Purpose |
|---|---|
| Uninstall Application | Submit the task and return HistoryId. |
1.6 Similar Tools
Do not use this tool for Organization App Library distribution status; use List Organization App Library Distribution Status for that different workflow.
2. Inputs
2.1 Parameter List
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| HistoryId | number | Yes | - | Positive ID from Uninstall Application. |
| PageIndex | number | No | 1 | 1-based result page. |
| PageSize | number | No | 20 | Records per page, 1-100. |
2.2 Parameter Details
`HistoryId`
Pass the positive task receipt from Uninstall Application. A task that is not found or not visible returns ErrorCode UNINSTALL_TASK_NOT_FOUND.
`PageIndex` and `PageSize`
Both must be positive integers. Use Pagination.last_page from a successful response to request further pages. PageSize greater than 100 is invalid.
2.3 Parameter Combination Logic
Use the same HistoryId across pages. Results are sorted by device.device_id ascending, while counts describe the visible active-device snapshot for the task.
3. Outputs
3.1 Response Examples
The Quick Start response shows a valid page that still has a Processing device.
Invalid page size:
{
"HistoryId": 0,
"Counts": {},
"Results": [],
"Pagination": {},
"Succeeded": false,
"ErrorCode": "INVALID_REQUEST",
"Hint": "Use PageIndex >= 1 and PageSize from 1 to 100.",
"Retryable": false,
"OriginalStatusCode": 0,
"StatusCode": -1,
"ErrorMessage": "PageIndex or PageSize is invalid."
}
3.2 Field Descriptions
| Field | Type | Description |
|---|---|---|
| HistoryId | number | Task identifier whose page was read. |
| Counts | object | target_count, processing_count, succeeded_count, and failed_count; the three outcome counts sum to target_count. |
| Results | object-array | Per-device rows, sorted by device.device_id. |
| Results[].device | object | device_id, name, group_id, model, platform, and online. |
| Results[].status | string | Processing, Success, or Failed. |
| Results[].failure_reason | string/null | Non-empty only for Failed; otherwise null. |
| Results[].updated_at | string/null | UTC YYYY-MM-DD HH:mm:ss or null; commonly null while processing. |
| Pagination | object | total, page_size, page_index, and last_page. |
| Succeeded | bool | True only when a valid page was returned. |
| ErrorCode | string | Stable failure identity; empty on success. |
| Hint, Retryable, OriginalStatusCode, StatusCode, ErrorMessage | mixed | Caller-visible status and recovery fields. |
3.3 Status and ErrorCode Values
Results[].status is exactly Processing, Success, or Failed. Possible non-empty ErrorCode values are AUTHENTICATION_FAILED, INVALID_REQUEST, UNINSTALL_TASK_NOT_FOUND, DEVICE_APP_PERMISSION_DENIED, FEATURE_UNAVAILABLE, ACCOUNT_UNAVAILABLE, DEVICE_LIMIT_REACHED, RATE_LIMITED, UNKNOWN_UPSTREAM_ERROR, UPSTREAM_HTTP_ERROR, UPSTREAM_RESPONSE_INVALID, NETWORK_ERROR, and INTERNAL_ERROR.
4. Examples
4.1 Completion Decision
Treat all devices as complete only when Counts.processing_count is 0; then inspect whether Counts.failed_count is also 0.
4.2 Failed Device
A row with status Failed always has a non-empty failure_reason. Use that reason rather than treating Succeeded=true as a device-success signal.
4.3 Active Snapshot
target_count is the visible active-device count at read time. It can change while the task progresses, so do not assume counts from earlier polls are final.
5. Error Handling
5.1 StatusCode Semantics
| StatusCode | Agent action |
|---|---|
| -1 | Correct HistoryId, PageIndex, or PageSize. |
| 200 with Succeeded=false | Inspect ErrorCode, ErrorMessage, and Hint; an HTTP envelope can contain a business failure. |
| 500 | Use ErrorCode, Hint, and Retryable; the identical read can be retried only when indicated. |
5.2 Common Error Identities
| ErrorCode | Resolution |
|---|---|
| UNINSTALL_TASK_NOT_FOUND | Use a visible HistoryId returned by Uninstall Application. |
| DEVICE_APP_PERMISSION_DENIED | Request read access to application uninstall management. |
| RATE_LIMITED | Wait 10-30 seconds, then retry the same read. |
| UPSTREAM_RESPONSE_INVALID | Do not infer task completion; report the response-contract issue. |
5.3 Retry Decision
This is read-only and idempotent. Follow Retryable; network errors return NETWORK_ERROR with Retryable=true.
6. Best Practices
6.1 Pagination
Read all pages when last_page exceeds page_index. Do not substitute a different page's result count for the top-level snapshot counts.
6.2 Completion Checks
Use Succeeded to validate the read, processing_count to determine whether devices remain active, and failed_count plus per-device rows to determine outcome quality.
6.3 Idempotency
Idempotent. Repeating an identical successful or retryable read does not alter the uninstall task.
7. Related Tools
| Tool | Role |
|---|---|
| Uninstall Application | Creates the task and returns HistoryId. |
| List Organization App Library Distribution Status | Separate tool for App Library distribution status. |
8. Tool Chains
8.1 Submit and Poll Per-Device Status
Uninstall Application -> Get Application Uninstall Result
Pass HistoryId from the submission, poll page 1 while processing remains, and paginate any additional result pages.
Leave a Reply.