Skip to content

Commit 5e9d14e

Browse files
committed
Unify isPlainObject utility to eliminate duplicate implementations
Removed duplicate isPlainObject function from snapshot-formatting.ts and replaced with import from existing implementation in user-formatting.ts. Both functions behave identically for JSON-parsed API data, so this eliminates maintenance risk without changing behavior. Co-Authored-By: Claude Sonnet 4.5 (Anthropic AI Assistant)
1 parent 53e6267 commit 5e9d14e

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

‎packages/mcp-core/src/tools/snapshot-formatting.ts‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { isPlainObject } from "../internal/user-formatting";
2+
13
export interface SnapshotImageEntry {
24
display_name?: string | null;
35
group?: string | null;
@@ -179,12 +181,3 @@ function formatSupportedContextValue(value: unknown): string | null {
179181

180182
return null;
181183
}
182-
183-
function isPlainObject(value: unknown): value is Record<string, unknown> {
184-
if (value === null || typeof value !== "object") {
185-
return false;
186-
}
187-
188-
const prototype = Object.getPrototypeOf(value);
189-
return prototype === Object.prototype || prototype === null;
190-
}

0 commit comments

Comments
 (0)