Skip to content

docs: add TypeScript MCP elicitation examples#790

Open
gautamsirdeshmukh wants to merge 1 commit intostrands-agents:mainfrom
gautamsirdeshmukh:docs/mcp-elicitation-typescript
Open

docs: add TypeScript MCP elicitation examples#790
gautamsirdeshmukh wants to merge 1 commit intostrands-agents:mainfrom
gautamsirdeshmukh:docs/mcp-elicitation-typescript

Conversation

@gautamsirdeshmukh
Copy link
Copy Markdown
Contributor

Description

Adds TypeScript examples to the MCP elicitation docs section, which previously said "Not supported in TypeScript." Includes both a server-side example using elicitInput() and a client-side example using the new elicitationCallback config, matching the structure of the existing Python examples.

Related Issues

Docs for strands-agents/sdk-typescript#232

Type of Change

  • New content

Checklist

  • I have read the CONTRIBUTING document
  • My changes follow the project's documentation style
  • I have tested the documentation locally using npm run dev
  • Links in the documentation are valid and working

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 28, 2026

Documentation Preview Ready

Your documentation preview has been successfully deployed!

Preview URL: https://d3ehv1nix5p99z.cloudfront.net/pr-cms-790/docs/user-guide/quickstart/overview/

Updated at: 2026-04-28T19:28:06.541Z

Comment thread src/content/docs/user-guide/concepts/tools/mcp-tools.ts Outdated
Comment thread src/content/docs/user-guide/concepts/tools/mcp-tools.mdx Outdated
@github-actions
Copy link
Copy Markdown
Contributor

Assessment: Comment

Good, well-scoped PR that adds TypeScript elicitation examples matching the existing Python structure. Two issues to address before merge: a @ts-nocheck comment leaking into rendered docs, and a duplicate TOC heading.

Review Details
  • Rendered output: The @ts-nocheck annotation is visible to users in the documentation preview and should be moved outside the snippet markers (or removed — it has no effect mid-file anyway).
  • Navigation: Duplicate ### Elicitation headings (one per tab) produce duplicate TOC entries (#elicitation / #elicitation-1).

The examples themselves are clear, well-structured, and consistent with the Python counterparts. 👍

Comment thread src/content/docs/user-guide/concepts/tools/mcp-tools.mdx Outdated
Comment thread src/content/docs/user-guide/concepts/tools/mcp-tools.mdx Outdated
@github-actions
Copy link
Copy Markdown
Contributor

Assessment: Comment

Good progress — the @ts-nocheck issue from the previous review has been resolved by inlining the server example. Two items remain before this is ready to merge.

Review Details
  • Duplicate TOC heading: Both tabs still define ### Elicitation, creating duplicate entries in the page's table of contents (#elicitation / #elicitation-1).
  • Type safety gap: The inlined server example (~40 lines of TypeScript in MDX) bypasses the snippet type-checking pattern used by every other TypeScript example in this file. Moving it to a .ts snippet with function-scoping would maintain consistency and catch future regressions.

The examples themselves are well-written and match the Python counterpart structure nicely.

@github-actions
Copy link
Copy Markdown
Contributor

Assessment: Approve

Both issues from previous reviews have been addressed — the @ts-nocheck leak is gone (server example inlined in MDX) and the duplicate TOC heading is fixed (heading removed from the TypeScript tab). The code is correct, well-formatted, and consistent with existing patterns in the file. LGTM.


// --8<-- [start:elicitation_client]
// client.ts
import type { ElicitationCallback } from '@strands-agents/sdk'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Issue: The elicitation_client snippet uses McpClient, StdioClientTransport, and Agent without importing them. Unlike mcp-tools.ts where these are imported at the file top and shared across all snippets, this is a separate file so the client snippet is missing its imports. The Python counterpart includes all necessary imports (from strands import Agent, from strands.tools.mcp import MCPClient, etc.), so readers copying the TypeScript client code won't have the full picture.

Suggestion: Add the missing imports inside the elicitation_client snippet:

// --8<-- [start:elicitation_client]
// client.ts
import { Agent, McpClient } from '@strands-agents/sdk'
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'
import type { ElicitationCallback } from '@strands-agents/sdk'
// ... rest of snippet

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Confirmed resolved — all three imports (Agent, McpClient, ElicitationCallback, StdioClientTransport) are present in the elicitation_client snippet.

@github-actions
Copy link
Copy Markdown
Contributor

Assessment: Comment

All four previous review issues are resolved — great iteration. One new item: the client snippet is missing imports for McpClient, StdioClientTransport, and Agent, which the Python counterpart includes.

Review Details
  • Resolved: @ts-nocheck visible in docs → now file-level in dedicated mcp-tools-elicitation.ts
  • Resolved: Duplicate ### Elicitation TOC entry → heading removed from TS tab
  • Resolved: Inlined server code not type-checked → now uses snippet references
  • New: Client snippet missing imports for McpClient, StdioClientTransport, Agent — users copying the code won't have the necessary imports (unlike the Python counterpart which is self-contained)

@github-actions
Copy link
Copy Markdown
Contributor

Assessment: Approve

All substantive issues from previous reviews are resolved. The dedicated mcp-tools-elicitation.ts snippet file is clean, both snippets include proper imports, @ts-nocheck is correctly file-level, formatting and line lengths pass, and the examples render correctly in the preview. LGTM.

@github-actions
Copy link
Copy Markdown
Contributor

Assessment: Approve

No changes since the last approval. All previously raised issues remain resolved: @ts-nocheck is file-level and outside snippets, client imports are complete, both examples use proper snippet references from a dedicated .ts file, formatting and line lengths pass. LGTM.

@github-actions
Copy link
Copy Markdown
Contributor

Assessment: Approve

The heading restructure in this latest push is a clean solution — moving ### Elicitation and the intro paragraph above the <Tabs> block eliminates the duplicate TOC entry while keeping both tabs self-contained. All other items from prior reviews remain resolved. LGTM.

@github-actions
Copy link
Copy Markdown
Contributor

Assessment: Approve

No substantive changes since the last approval (likely a rebase). Preview is now up to date and confirms single #elicitation TOC entry. All prior issues remain resolved. LGTM.

@JackYPCOnline
Copy link
Copy Markdown
Contributor

Should refactor to fix CI failure?

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.

3 participants