fastmcp.server.tasks.converters
SEP-1686 task result converters.
Converts raw task return values to MCP result types.
Functions
convert_tool_result
server: FastMCP server instanceraw_value: The raw return value from user’s tool functiontool_name: Name of the tool (to get output_schema and serializer)client_task_id: Client task ID for related-task metadata
- CallToolResult with properly formatted content and structured content
convert_prompt_result
server: FastMCP server instanceraw_value: The raw return value from user’s prompt functionprompt_name: Name of the promptclient_task_id: Client task ID for related-task metadata
- GetPromptResult with properly formatted messages
convert_resource_result
server: FastMCP server instanceraw_value: The raw return value from user’s resource function (str or bytes)uri: Resource URI (for the contents response)client_task_id: Client task ID for related-task metadata
- Dict with ‘contents’ key containing list of resource contents

