Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions .changeset/code-mode-destructive-defaults.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@truefoundry/trueforge-core': patch
'@truefoundry/trueforge': patch
---

Prefer MCP Python SDK 2.0 snake_case tool annotation fields, with camelCase fallback for older SDKs, without changing destructive-tool detection behavior.
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,14 @@ def _is_destructive(tool: Tool) -> bool:
annotations = tool.annotations
if annotations is None:
return False
return bool(annotations.destructiveHint) or (not annotations.readOnlyHint and annotations.readOnlyHint is not None)

destructive = getattr(
annotations, "destructive_hint", getattr(annotations, "destructiveHint", None)
)
read_only = getattr(
annotations, "read_only_hint", getattr(annotations, "readOnlyHint", None)
)
return bool(destructive) or (not read_only and read_only is not None)

async def _ensure_non_destructive(server: str, tool_name: str) -> None:
tool = await _get_tool(server, tool_name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,9 @@ def _is_destructive(tool: dict[str, Any]) -> bool:
return False
if not isinstance(annotations, dict):
return False
destructive = annotations.get("destructiveHint")
read_only = annotations.get("readOnlyHint")

read_only = annotations.get("read_only_hint", annotations.get("readOnlyHint"))
destructive = annotations.get("destructive_hint", annotations.get("destructiveHint"))
return bool(destructive) or (not read_only and read_only is not None)


Expand Down
Loading