Skip to content

docs: note type vs interface for structuredContent#1784

Open
felixweinberger wants to merge 1 commit intomainfrom
fweinberger/docs-structured-content-types
Open

docs: note type vs interface for structuredContent#1784
felixweinberger wants to merge 1 commit intomainfrom
fweinberger/docs-structured-content-types

Conversation

@felixweinberger
Copy link
Copy Markdown
Contributor

Closes #837. Documents the TypeScript-native workaround for the named interface assignability issue with structuredContent.

Motivation and Context

Issue #837: users hit type errors when using named interfaces for structuredContent. The fix is to use type aliases instead.

Types of changes

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

@felixweinberger felixweinberger requested a review from a team as a code owner March 27, 2026 11:57
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 27, 2026

⚠️ No Changeset found

Latest commit: 59d0165

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 27, 2026

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/client@1784

@modelcontextprotocol/server

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/server@1784

@modelcontextprotocol/express

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/express@1784

@modelcontextprotocol/hono

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/hono@1784

@modelcontextprotocol/node

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/node@1784

commit: 59d0165

Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — straightforward docs addition noting a well-known TypeScript gotcha.

Extended reasoning...

Overview

This PR adds a single documentation note to docs/server.md explaining that users should use type aliases instead of interface when defining named types for structuredContent, due to TypeScript's implicit index signature behavior. It closes issue #837.

Security risks

None. This is a pure documentation change with no code modifications.

Level of scrutiny

Minimal scrutiny needed. This is a small, self-contained documentation addition to a markdown file. The technical content is accurate — TypeScript interfaces lack implicit index signatures, so they are not assignable to { [key: string]: unknown }. The workaround (use type or spread) is correct.

Other factors

No outstanding reviewer comments. No changeset needed for a docs-only change. The note is placed in the right location (right after the registerTool example that uses structuredContent). The formatting follows existing conventions in the file (GitHub-flavored admonition blocks).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

typing structuredContent indirectly causes type error

1 participant