Address @claude review: format core/, typed output-validation error, document progress heuristic
- Run Prettier on the 60 core/ files this PR touched — the deterministic import rewrite had collapsed multi-line imports and left throws unwrapped; core/ is in no format gate so it slipped past CI. Now Prettier-clean. - Default-path output-schema violation now throws ProtocolError(ProtocolErrorCode.InvalidParams, …) instead of a bare Error, matching the prior v1 contract (SDK threw a typed McpError with a code) so downstream `instanceof`/`.code` branching keeps working. - Document the "assumes serial construction" invariant on pollTaskToolCall's progress-subscription revival (the `_progressHandlers` new-key heuristic). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
19a6df7ad3
commit
f9f79fff54
4 changed files with 296 additions and 95 deletions
|
|
@ -3,7 +3,11 @@ import type { InspectorClientProtocol } from "../mcp/inspectorClientProtocol.js"
|
|||
import type { AppRendererClient } from "../mcp/inspectorClientProtocol.js";
|
||||
import type { TypedEvent } from "../mcp/inspectorClientEventTarget.js";
|
||||
import type { ConnectionStatus } from "../mcp/types.js";
|
||||
import type { ClientCapabilities, ServerCapabilities, Implementation } from "@modelcontextprotocol/client";
|
||||
import type {
|
||||
ClientCapabilities,
|
||||
ServerCapabilities,
|
||||
Implementation,
|
||||
} from "@modelcontextprotocol/client";
|
||||
|
||||
// Module-scope frozen object so the `?? EMPTY_CLIENT_CAPABILITIES`
|
||||
// fallback below doesn't return a fresh literal on every render —
|
||||
|
|
|
|||
|
|
@ -55,10 +55,7 @@ export function useManagedPrompts(
|
|||
onListChangedChange,
|
||||
);
|
||||
return () => {
|
||||
managedPromptsState.removeEventListener(
|
||||
"promptsChange",
|
||||
onPromptsChange,
|
||||
);
|
||||
managedPromptsState.removeEventListener("promptsChange", onPromptsChange);
|
||||
managedPromptsState.removeEventListener(
|
||||
"listChangedChange",
|
||||
onListChangedChange,
|
||||
|
|
|
|||
|
|
@ -39,10 +39,7 @@ export function usePagedRequestorTasks(
|
|||
setTasks(pagedRequestorTasksState.getTasks());
|
||||
setNextCursor(pagedRequestorTasksState.getNextCursor() ?? undefined);
|
||||
const onTasksChange = (
|
||||
event: TypedEventGeneric<
|
||||
PagedRequestorTasksStateEventMap,
|
||||
"tasksChange"
|
||||
>,
|
||||
event: TypedEventGeneric<PagedRequestorTasksStateEventMap, "tasksChange">,
|
||||
) => {
|
||||
setTasks(event.detail);
|
||||
setNextCursor(pagedRequestorTasksState.getNextCursor() ?? undefined);
|
||||
|
|
|
|||
|
|
@ -21,9 +21,7 @@ export function usePagedTools(
|
|||
client: InspectorClientProtocol | null,
|
||||
pagedToolsState: PagedToolsState | null,
|
||||
): UsePagedToolsResult {
|
||||
const [tools, setTools] = useState<Tool[]>(
|
||||
pagedToolsState?.getTools() ?? [],
|
||||
);
|
||||
const [tools, setTools] = useState<Tool[]>(pagedToolsState?.getTools() ?? []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!pagedToolsState) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue