-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Initial Checks
- I confirm that I'm using the latest version of MCP Python SDK
- I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue
Description
In the tool definition, outputSchema is included, but when calling the tools/list interface, the returned information shows outputSchema=None. What is the reason for this?
-
The content in the Tool information is:
{'add_two_numbers': Tool(fn=<function add_two_number at 0x7f95ed506840>, name='add_two_numbers', title=None, description='', parameters={'properties': {'a': {'title': 'A', 'type': 'integer'}, 'b': {'title': 'B', 'type': 'integer'}}, 'required': ['a', 'b'], 'title': 'add_two_numberArguments', 'type': 'object'}, fn_metadata=FuncMetadata(arg_model=<class 'mcp.server.fastmcp.utilities.func_metadata.add_two_numberArguments'>, output_schema={'properties': {'result': {'title': 'Result', 'type': 'integer'}}, 'required': ['result'], 'title': 'add_two_numberOutput', 'type': 'object'}, output_model=<class 'mcp.server.fastmcp.utilities.func_metadata.add_two_numberOutput'>, wrap_output=True), is_async=False, context_kwarg=None, annotations=None)} -
The result of calling tools/list is:
Tool(name='add_two_numbers', title=None, description='', inputSchema={'properties': {'a': {'title': 'A', 'type': 'integer'}, 'b': {'title': 'B', 'type': 'integer'}}, 'required': ['a', 'b'], 'title': 'add_two_numberArguments', 'type': 'object'}, outputSchema=None, annotations=None, meta=None)
Is it because ToolInfo does not include this information?
Example Code
Python & MCP Python SDK
import requests
import asyncio
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client
from mcp.client.sse import sse_client
from mcp.client.stdio import stdio_client
from mcp.server import FastMCP
async def main():
url = "http://localhost:9200/mcp"
async with streamablehttp_client(url=url) as (read, write,id):
async with ClientSession(read, write) as session:
await session.initialize()
tools_list = await session.list_tools()
……