File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,11 @@ import * as fs from "fs";
55import * as path from "path" ;
66import * as os from "os" ;
77import { getSpawnMaxBuffer } from "../config/max-buffer.js" ;
8- import { contextParameter , dryRunParameter , namespaceParameter } from "../models/common-parameters.js" ;
8+ import {
9+ contextParameter ,
10+ dryRunParameter ,
11+ namespaceParameter ,
12+ } from "../models/common-parameters.js" ;
913
1014export const kubectlPatchSchema = {
1115 name : "kubectl_patch" ,
@@ -93,6 +97,13 @@ export async function kubectlPatch(
9397
9498 // Handle patch data
9599 if ( input . patchData ) {
100+ if ( input . patchData === null || typeof input . patchData !== "object" ) {
101+ throw new McpError (
102+ ErrorCode . InvalidRequest ,
103+ "patchData must be a valid JSON object, not a string."
104+ ) ;
105+ }
106+
96107 // Create a temporary file for the patch data
97108 const tmpDir = os . tmpdir ( ) ;
98109 tempFile = path . join ( tmpDir , `patch-${ Date . now ( ) } .json` ) ;
You can’t perform that action at this time.
0 commit comments