Skip to content

Commit f64a7ea

Browse files
cliffhallclaude
andcommitted
Fix review issues from Claude's code review
- Default taskSupport fallback to "forbidden" per MCP spec (was "optional") - Fix import path to use @/ alias consistently - Fix misleading "type guard" comment on getTaskSupport - Extract getTaskSupport to a variable to avoid duplicate calls in render - Export ExtendedTool and import in tests instead of duplicating Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4bcffe4 commit f64a7ea

2 files changed

Lines changed: 9 additions & 14 deletions

File tree

client/src/components/ToolsTab.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ import {
5151
hasValidMetaName,
5252
hasValidMetaPrefix,
5353
isReservedMetaKey,
54-
} from "../utils/metaUtils";
54+
} from "@/utils/metaUtils";
5555

5656
/**
5757
* Extended Tool type that includes optional fields used by the inspector.
5858
*/
59-
interface ExtendedTool extends Tool, WithIcons {
59+
export interface ExtendedTool extends Tool, WithIcons {
6060
_meta?: Record<string, unknown>;
6161
execution?: {
6262
taskSupport?: "forbidden" | "required" | "optional";
@@ -69,7 +69,7 @@ const hasMeta = (
6969
): tool is ExtendedTool & { _meta: Record<string, unknown> } =>
7070
typeof (tool as ExtendedTool)._meta !== "undefined";
7171

72-
// Type guard to detect execution.taskSupport
72+
// Returns the execution.taskSupport value for a tool, defaulting to "forbidden" per MCP spec
7373
const getTaskSupport = (
7474
tool: Tool | null,
7575
): "forbidden" | "required" | "optional" => {
@@ -83,7 +83,7 @@ const getTaskSupport = (
8383
) {
8484
return taskSupport;
8585
}
86-
return "optional";
86+
return "forbidden";
8787
};
8888

8989
// Type guard to safely detect the optional annotations field
@@ -264,6 +264,8 @@ const ToolsTab = ({
264264
return trimmedKey !== "" && !hasValidMetaName(trimmedKey);
265265
});
266266

267+
const taskSupport = getTaskSupport(selectedTool);
268+
267269
return (
268270
<TabsContent value="tools">
269271
<div className="grid grid-cols-2 gap-4">
@@ -777,15 +779,15 @@ const ToolsTab = ({
777779
</div>
778780
</div>
779781
)}
780-
{getTaskSupport(selectedTool) !== "forbidden" && (
782+
{taskSupport !== "forbidden" && (
781783
<div className="flex items-center space-x-2">
782784
<Checkbox
783785
id="run-as-task"
784786
checked={runAsTask}
785787
onCheckedChange={(checked: boolean) =>
786788
setRunAsTask(checked)
787789
}
788-
disabled={getTaskSupport(selectedTool) === "required"}
790+
disabled={taskSupport === "required"}
789791
/>
790792
<Label
791793
htmlFor="run-as-task"

client/src/components/__tests__/ToolsTab.test.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { render, screen, fireEvent, act } from "@testing-library/react";
22
import "@testing-library/jest-dom";
33
import { describe, it, jest, beforeEach } from "@jest/globals";
4-
import ToolsTab from "../ToolsTab";
4+
import ToolsTab, { ExtendedTool } from "../ToolsTab";
55
import { Tool } from "@modelcontextprotocol/sdk/types.js";
66
import { Tabs } from "../ui/tabs";
77
import { cacheToolOutputSchemas } from "../../utils/schemaUtils";
@@ -12,13 +12,6 @@ import {
1212
RESERVED_NAMESPACE_MESSAGE,
1313
} from "../../utils/metaUtils";
1414

15-
interface ExtendedTool extends Tool {
16-
_meta?: Record<string, unknown>;
17-
execution?: {
18-
taskSupport?: "forbidden" | "required" | "optional";
19-
};
20-
}
21-
2215
describe("ToolsTab", () => {
2316
beforeEach(() => {
2417
// Clear the output schema cache before each test

0 commit comments

Comments
 (0)