# Read task MCP App resources

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

Read app resources bound to a runtime task. URI identifies the resource; the backend resolves the actual service URL and credentials.

```text
POST https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/agent-runtime-tasks/{task_id}/mcp-apps/resource
```

## Before you call this API

Prepare a personal access token, Workspace ID, and a runtime task that returned an app description in the current environment. Use the original task's tool ID, app resource URI, or tool name. The current identity still requires agent-use and corresponding connection/service privileges. See [Task scope and results](scope-and-results.md).

## Request parameters

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Request example

```bash
curl -X POST "https://api.moi.matrixorigin.cn/v5/workspaces/$WORKSPACE_ID/agent-runtime-tasks/$TASK_ID/mcp-apps/resource" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  --data '{"tool_id":"tool-example","uri":"ui://example/card.html"}'
```

:::::
:::::{tab-item} Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `workspace_id` | string | Yes | Workspace ID in the current environment, matching X-Workspace-ID. |
| `task_id` | string | Yes | Agent runtime task ID owning this app. |
| `X-Workspace-ID` | string | Yes | Workspace owning the request. |
| `X-API-Key` | string | Yes | Personal access token in the current environment. |
| `uri` | string | Yes | Absolute resource URI already bound to the original task. Use unchanged, without credentials, at most 2048 bytes. |
| `tool_id` | string | No | Narrows URI lookup to one tool in the original task. |

:::::
::::::
:::::::

## Successful response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "code": 0,
  "data": {
    "uri": "ui://example/card.html",
    "contents": [
      {
        "uri": "ui://example/card.html",
        "mimeType": "text/html",
        "text": "<p>示例应用</p>"
      }
    ]
  }
}
```

:::::
:::::{tab-item} Fields

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | 0 on success. |
| `data.uri` | string | Requested resource URI. |
| `data.contents` | object (array of objects) | Resource content blocks. |
| `data.contents[].uri` | string | URI of this content block; do not assume every block matches the requested URI. |
| `data.contents[].mimeType` | string | Optional MIME type; retain camelCase key spelling. |
| `data.contents[].text` | string | Text content; mutually exclusive with blob on MCP resource paths. |
| `data.contents[].blob` | string | Base64-encoded content; mutually exclusive with text on MCP resource paths. |
| `data.contents[]._meta` | JSON value | Optional resource metadata, retained according to the provider contract. |

:::::
::::::
:::::::

## Error responses

| HTTP / code | Conditions and handling |
| --- | --- |
| 400 / 2 | Invalid JSON, fields, URI, or selector. |
| 403 / 5 | Current agent-use or corresponding privileges denied. |
| 404 / 3 | Task outside the current scope, or tool/URI not bound. |
| 409 / 2 | Task is failed, canceled, or rejected; app operations cannot continue. |
| 502 / 1 | Invalid MCP resource provider response; distinct from the tool's own is_error. |
| 503 / 15 | Runtime or provider unavailable. |
| 500 / 1 | Unclassified internal or persistence failure; message uses a localized generic description. |

Errors use localized message; authentication may additionally return string code/msg. See [In-Task Knowledge Retrieval](../../../../developer/cli/tasks/runtime-knowledge.md) for recovery and environment states.
