Feature Request: Support for accessing instructions from InitializeResult
Metadata-Version: 2.4
Name: langchain-mcp-adapters
Version: 0.2.1
TL;DR
Problem: MCP servers return valuable instructions in their InitializeResult, but langchain-mcp-adapters discards this data at line 481 of tools.py.
Solution: Create a new instructions.py module with functions like get_instructions() to access this important metadata.
Impact: Zero breaking changes, follows existing package patterns, enables better MCP server integration.
Description
According to the MCP protocol specification, the initialize() method returns an InitializeResult that includes an instructions field in the ServerCapabilities. However, in the current implementation of langchain-mcp-adapters, this result is discarded after calling await tool_session.initialize().
Current Behavior
In tools.py at line 481:
async with create_session(
connection, mcp_callbacks=mcp_callbacks
) as tool_session:
await tool_session.initialize() # ← Result is discarded here
tools = await _list_all_tools(tool_session)
The InitializeResult returned by initialize() contains valuable information including the instructions field which provides server-specific guidance for AI models, but it's currently being thrown away.
Expected Behavior
It would be beneficial to have a way to access the instructions field from the InitializeResult. This could be useful for:
- Providing context to LLM agents about how to use the MCP server effectively
- Displaying server-specific instructions to users
- Programmatically accessing server metadata and capabilities
- Following the MCP protocol specification properly
Proposed Solution
I suggest creating a new module file instructions.py in the langchain_mcp_adapters package to handle server capabilities, including the instructions field.
Thank you for maintaining this excellent library! This feature would greatly enhance the usability of MCP servers with LangChain applications.
Feature Request: Support for accessing
instructionsfromInitializeResultTL;DR
Problem: MCP servers return valuable
instructionsin theirInitializeResult, butlangchain-mcp-adaptersdiscards this data at line 481 oftools.py.Solution: Create a new
instructions.pymodule with functions likeget_instructions()to access this important metadata.Impact: Zero breaking changes, follows existing package patterns, enables better MCP server integration.
Description
According to the MCP protocol specification, the
initialize()method returns anInitializeResultthat includes aninstructionsfield in theServerCapabilities. However, in the current implementation oflangchain-mcp-adapters, this result is discarded after callingawait tool_session.initialize().Current Behavior
In
tools.pyat line 481:The
InitializeResultreturned byinitialize()contains valuable information including theinstructionsfield which provides server-specific guidance for AI models, but it's currently being thrown away.Expected Behavior
It would be beneficial to have a way to access the
instructionsfield from theInitializeResult. This could be useful for:Proposed Solution
I suggest creating a new module file
instructions.pyin thelangchain_mcp_adapterspackage to handle server capabilities, including theinstructionsfield.Thank you for maintaining this excellent library! This feature would greatly enhance the usability of MCP servers with LangChain applications.