Skip to content

Commit 21c0fa3

Browse files
committed
address comment: use swithc
1 parent b8833e0 commit 21c0fa3

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/tools/tool.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,23 @@ export abstract class ToolBase {
3333
description: this.description,
3434
};
3535

36-
if (this.operationType === "read" || this.operationType === "metadata") {
37-
annotations.readOnlyHint = true;
38-
annotations.destructiveHint = false;
39-
} else {
40-
annotations.destructiveHint = this.operationType === "delete";
36+
switch (this.operationType) {
37+
case "read":
38+
case "metadata":
39+
annotations.readOnlyHint = true;
40+
annotations.destructiveHint = false;
41+
break;
42+
case "delete":
43+
annotations.readOnlyHint = false;
44+
annotations.destructiveHint = true;
45+
break;
46+
case "create":
47+
case "update":
48+
annotations.destructiveHint = false;
49+
annotations.readOnlyHint = false;
50+
break;
51+
default:
52+
break;
4153
}
4254

4355
return annotations;

0 commit comments

Comments
 (0)