feat: allow modification of built-in tool types

Remove restrictions on updating and deleting built-in tool types.
Show delete button for all tool types in Tool Workshop.
This commit is contained in:
Fusion
2026-05-22 23:20:59 +02:00
parent 6a7657aeda
commit 02a2ad6df5
2 changed files with 22 additions and 42 deletions
+2 -4
View File
@@ -406,8 +406,7 @@ async def update_tool_type(
if tool_type is None: if tool_type is None:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="tool type not found") raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="tool type not found")
if tool_type.is_builtin: # Built-in tool types can now be modified
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="cannot modify built-in tool types")
update_data = data.model_dump(exclude_unset=True) update_data = data.model_dump(exclude_unset=True)
@@ -625,8 +624,7 @@ async def delete_tool_type(
if tool_type is None: if tool_type is None:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="tool type not found") raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="tool type not found")
if tool_type.is_builtin: # Built-in tool types can now be deleted
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="cannot delete built-in tool types")
await session.delete(tool_type) await session.delete(tool_type)
await session.commit() await session.commit()
+20 -38
View File
@@ -561,44 +561,26 @@ export const ToolWorkshopPage = () => {
{toolType.category || "Uncategorized"} · {toolType.interface_type === "web" ? `Port ${toolType.default_port}` : "Terminal"} {toolType.category || "Uncategorized"} · {toolType.interface_type === "web" ? `Port ${toolType.default_port}` : "Terminal"}
</div> </div>
</div> </div>
{toolType.is_builtin && ( <button
<span onClick={(e) => {
style={{ e.stopPropagation();
fontSize: "0.625rem", handleDeleteToolType(toolType.id);
textTransform: "uppercase", }}
padding: "0.125rem 0.375rem", style={{
borderRadius: "9999px", background: "none",
background: selectedToolTypeId === toolType.id ? "rgba(255,255,255,0.25)" : "var(--muted)", border: "none",
color: selectedToolTypeId === toolType.id ? "white" : "var(--muted)", color: selectedToolTypeId === toolType.id ? "rgba(255,255,255,0.8)" : "var(--muted)",
fontWeight: 600, cursor: "pointer",
flexShrink: 0, padding: "0.25rem",
}} borderRadius: "0.25rem",
> flexShrink: 0,
Built-in opacity: 0,
</span> }}
)} className="delete-btn"
{!toolType.is_builtin && ( title="Delete tool type"
<button >
onClick={(e) => { <Icon name="delete" size="sm" />
e.stopPropagation(); </button>
handleDeleteToolType(toolType.id);
}}
style={{
background: "none",
border: "none",
color: selectedToolTypeId === toolType.id ? "rgba(255,255,255,0.8)" : "var(--muted)",
cursor: "pointer",
padding: "0.25rem",
borderRadius: "0.25rem",
flexShrink: 0,
opacity: 0,
}}
className="delete-btn"
title="Delete tool type"
>
<Icon name="delete" size="sm" />
</button>
)}
</button> </button>
))} ))}
</div> </div>