Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions fastapi_mcp/openapi/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,21 @@ def convert_openapi_to_mcp_tools(
if required_props:
input_schema["required"] = required_props

# Create the MCP tool definition
tool = types.Tool(name=operation_id, description=tool_description, inputSchema=input_schema)
# Create the MCP tool definition with annotations based on HTTP method
annotations = types.ToolAnnotations(
title=operation_id,
readOnlyHint=(method == "get"),
destructiveHint=(method == "delete"), # Only DELETE destroys data
idempotentHint=(method in ("get", "put", "delete")), # GET, PUT, DELETE are idempotent
openWorldHint=True, # All generated tools call external APIs
)

tool = types.Tool(
name=operation_id,
description=tool_description,
inputSchema=input_schema,
annotations=annotations,
)

tools.append(tool)

Expand Down