cloudflare / cloudflare/cloudflare-docs

Agents MCP client-api example imports isUnauthorized / isTransportNotImplemented, which the agents package does not export

Open
#33,265 0 comments 0 reactions 2 assignees Claimed by @rita3ko View on GitHub
product:agents
Dominant language
MDX
Stars
5.2k
Forks
16.7k
Avg merge
2d 6h
Merged PRs (30d)
337

Description

### Existing documentation URL(s)

https://developers.cloudflare.com/agents/model-context-protocol/apis/client-api/

### What is the issue?

The error-handling example imports two helpers that the `agents` package does not export,
so it cannot compile:

```ts
import { isUnauthorized, isTransportNotImplemented } from "agents";
```

Checked against `agents@0.22.0`:

- Neither name appears in **any** `.d.ts` in the published package, under any subpath in
its `exports` map — not `agents`, not `agents/mcp`, not `agents/mcp/client`.
- Both do exist as functions in one shipped internal chunk
(`dist/client-*.js`, from `src/mcp/client/errors.ts`), so they are internal helpers
rather than public API.

I did not guess a replacement, because there does not appear to be a public equivalent —
the closest exported error surface in the package is `AgentConnectionError`,
`isErrorRetryable` and `isPlatformTransientError`, none of which express "the MCP server
returned 401" or "this transport is not implemented".

So this needs someone who knows the intent to decide between:

1. exporting the two helpers from the SDK and leaving the docs as they are, or
2. rewriting the example against whatever the supported way to detect these two cases is.

### Additional information

Found by extracting every `import { … } from "…"` in the docs' TypeScript blocks and
checking each named import against the published package typings. The same pass turned up
two other broken imports on nearby pages, which are straightforward and are fixed in the
PR linked below:

- `agents/runtime/execution/schedule-tasks` imported `getSchedulePrompt` and
`scheduleSchema` from `"agents"`; they are exported from `agents/schedules/parser`.
- `agents/examples/browser-agent` imported `createBrowserToolHandlers`, which does not
exist in the package at all and was unused in the snippet.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.