[FEAT] Add argument for removing adding response info to tool descriptions
Is your feature request related to a problem? Please describe. Response documentation is automatically added to my tool descriptions when using this package. This has the potential to overload the models I use with irrelevant and repetitive information.
Describe the solution you'd like Add an argument to the FastApiMCP class initialisation that disables this automatic behaviour.
Describe alternatives you've considered Using the standard MCP package's server component on its own proves to be too much of a challenge given my FastAPI-compatible code.
Additional context
I have the same need! The automatic response information in tool descriptions can consume too much context space.
I've submitted a PR that adds an include_response_info parameter to FastApiMCP. When set to False, it completely removes all response information (including the ### Responses: section) from tool descriptions.
The implementation maintains backward compatibility (defaults to True). This should resolve the issue of response documentation consuming excessive context space.
Another approach: could we use outputSchema for response_info instead?
p.s. Tool class definition in mcp package
class Tool(BaseMetadata):
"""Definition for a tool the client can call."""
description: str | None = None
"""A human-readable description of the tool."""
inputSchema: dict[str, Any]
"""A JSON Schema object defining the expected parameters for the tool."""
outputSchema: dict[str, Any] | None = None
"""
An optional JSON Schema object defining the structure of the tool's output
returned in the structuredContent field of a CallToolResult.
"""
annotations: ToolAnnotations | None = None
"""Optional additional tool information."""
meta: dict[str, Any] | None = Field(alias="_meta", default=None)
"""
See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
for notes on _meta usage.
"""
model_config = ConfigDict(extra="allow")