[PR #2082] [CLOSED] docs: wrap MCP example code in async function #2112

Closed
opened 2026-02-17 17:23:04 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/docs/pull/2082
Author: @YassinNouh21
Created: 1/5/2026
Status: Closed

Base: mainHead: fix/issue-2016-mcp-async-wrapper


📝 Commits (5)

  • ebc20df docs: fix ToolRuntime parameter naming in short-term memory docs
  • 8335bad docs: wrap MCP example code in async function
  • 6f48b9b Merge branch 'main' into fix/issue-2016-mcp-async-wrapper
  • a479d8b Merge branch 'main' into fix/issue-2016-mcp-async-wrapper
  • d23743e Merge branch 'main' into fix/issue-2016-mcp-async-wrapper

📊 Changes

1 file changed (+30 additions, -25 deletions)

View changed files

📝 src/oss/langchain/mcp.mdx (+30 -25)

📄 Description

Overview

Fix SyntaxError in MCP documentation caused by using await statements at module level without an async function wrapper.

Type of change

Type: Fix typo/bug/link/formatting

Related issues/PRs

Checklist

  • I have read the contributing guidelines
  • I have tested my changes locally using make build
  • All code examples have been tested and work correctly
  • I have used root relative paths for internal links
  • I have updated navigation in src/docs.json if needed

Additional notes

The Python code example in the MCP documentation was using await at module level which causes:

SyntaxError: 'await' outside function

Fixed by:

  1. Adding import asyncio
  2. Wrapping async code in async def main():
  3. Adding if __name__ == "__main__": asyncio.run(main())

AI-assisted contribution using Claude.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/docs/pull/2082 **Author:** [@YassinNouh21](https://github.com/YassinNouh21) **Created:** 1/5/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/issue-2016-mcp-async-wrapper` --- ### 📝 Commits (5) - [`ebc20df`](https://github.com/langchain-ai/docs/commit/ebc20dfd0a45818d0f65eba56ee5fbb9e0f2db05) docs: fix ToolRuntime parameter naming in short-term memory docs - [`8335bad`](https://github.com/langchain-ai/docs/commit/8335bad60c97c374c0b541cc8d18ce17021c3949) docs: wrap MCP example code in async function - [`6f48b9b`](https://github.com/langchain-ai/docs/commit/6f48b9bee3b09fb216896cca73bfda3ebe439b95) Merge branch 'main' into fix/issue-2016-mcp-async-wrapper - [`a479d8b`](https://github.com/langchain-ai/docs/commit/a479d8bc1e92030d9f22b5328f9c587bb4aee340) Merge branch 'main' into fix/issue-2016-mcp-async-wrapper - [`d23743e`](https://github.com/langchain-ai/docs/commit/d23743e31d5102936650cb16f10da57dc088123b) Merge branch 'main' into fix/issue-2016-mcp-async-wrapper ### 📊 Changes **1 file changed** (+30 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `src/oss/langchain/mcp.mdx` (+30 -25) </details> ### 📄 Description ## Overview Fix SyntaxError in MCP documentation caused by using `await` statements at module level without an async function wrapper. ## Type of change **Type:** Fix typo/bug/link/formatting ## Related issues/PRs - GitHub issue: fixes langchain-ai/docs#2016 ## Checklist - [x] I have read the contributing guidelines - [x] I have tested my changes locally using `make build` - [x] All code examples have been tested and work correctly - [x] I have used **root relative** paths for internal links - [x] I have updated navigation in `src/docs.json` if needed ## Additional notes The Python code example in the MCP documentation was using `await` at module level which causes: ``` SyntaxError: 'await' outside function ``` Fixed by: 1. Adding `import asyncio` 2. Wrapping async code in `async def main():` 3. Adding `if __name__ == "__main__": asyncio.run(main())` AI-assisted contribution using Claude. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-17 17:23:04 -05:00
yindo closed this issue 2026-02-17 17:23:04 -05:00
yindo changed title from [PR #2082] docs: wrap MCP example code in async function to [PR #2082] [CLOSED] docs: wrap MCP example code in async function 2026-06-05 18:16:43 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#2112