Skip to content

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

Description

@vahidshaik1901

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:

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

product:agentsBuild and deploy AI-powered Agents on Cloudflare that can act autonomously.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions