Parameter Types, Tool Descriptions, and Additional Customization
Additional Customization Parameters
The @mcp.tool decorator accepts additional parameters to further customize the tool's behavior:
output_schema: Define a custom output schema if the return type annotation is not sufficient or if you want to provide more details about the structured output format.timeout: Set a custom timeout (in seconds) for the tool's execution, which can help prevent long-running operations from blocking the MCP server. We can, for example, for our tool set a timeout of 30 seconds (development timeouts should be longer to allow for debugging).annotations: Add metadata about the tool's behavior.And more.
Here's an example of using some of these parameters:
@mcp.tool(
name="calculate_dog_age",
description="Calculate the real age of a dog in human years based on the provided dog age.",
timeoutPractical MCP with FastMCP & LangChain
Engineering the Agentic ExperienceEnroll now to unlock current content and receive all future updates for free. Your purchase supports the author and fuels the creation of more exciting content. Act fast, as the price will rise as the course nears completion!
