<span id="读取访客任务的mcp应用资源"></span>

# Read an MCP application resource for a visitor task

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

Resources must be bound by the task manifest, not arbitrary proxied URLs. Execution restores publisher identity. Returns uri/contents; content union types and resource limits still require the full MCP contract.


```http
POST https://api.moi.matrixorigin.cn/v5/public/webapp/mcp-apps/resource
```

<span id="调用前准备"></span>

## Before you call this API

`BASE_URL` uses the product API prefix `https://api.moi.matrixorigin.cn/v5`. For a dedicated deployment, use its corresponding product API address.

[Prepare links and visitor identity in the same environment](identity-lifecycle.md#prepare). Do not supply a product PAT or Workspace request header.

<span id="请求"></span>

## Request

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

```bash
curl --request POST \
  "$BASE_URL/public/webapp/mcp-apps/resource?webapp=$AGENT_ID&t=$WEBAPP_TOKEN&s=$WEBAPP_SESSION" \
  --header "Content-Type: application/json" \
  --data @- <<JSON
{"conversation_id": "${CONVERSATION_ID}", "task_id": "$TASK_ID", "uri": "ui://example/app.html"}
JSON
```

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

| Parameter | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `webapp` | Query | string | Yes | Agent ID corresponding to the link. |
| `t` | Query | string | Yes | Current valid publication token. For short-code links, resolve first and use the short code as t. |
| `s` | Query | string | Yes | Visitor session credentials under the same publication. |
| `conversation_id` | Body | string | Yes | This visitor conversation ID. |
| `task_id` | Body | string | Yes | Task ID within that conversation. |
| `tool_id` | Body | string | No | Tool selection from the target task manifest. |
| `uri` | Body | string | Yes | MCP resource URI bound by the task manifest. |

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

<span id="成功响应"></span>

## Successful response

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

```json
{
  "code": 0,
  "data": {
    "uri": "ui://example/app.html",
    "contents": []
  }
}
```

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

Success returns HTTP 200 with numeric code=0. Read data's [Object descriptions](objects.md) with the example; the conversation-creation example shows a field excerpt only.

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

<span id="错误响应"></span>

## Error response

[Public errors and identity handling](identity-lifecycle.md#errors) distinguishes unavailable links, disablement, invalid sessions, parameters, and system failures.
