Skip to content

Commit d9101fe

Browse files
committed
fix: reject toolDefinitions and apiGateway config for schema-based targets
Mirror CDK schema validation: openApiSchema/smithyModel targets should reject toolDefinitions (tools are auto-derived) and apiGateway config.
1 parent a884df7 commit d9101fe

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/schema/schemas/mcp.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,20 @@ export const AgentCoreGatewayTargetSchema = z
415415
path: ['endpoint'],
416416
});
417417
}
418+
if (data.toolDefinitions && data.toolDefinitions.length > 0) {
419+
ctx.addIssue({
420+
code: z.ZodIssueCode.custom,
421+
message: `toolDefinitions is not applicable for ${data.targetType} target type`,
422+
path: ['toolDefinitions'],
423+
});
424+
}
425+
if (data.apiGateway) {
426+
ctx.addIssue({
427+
code: z.ZodIssueCode.custom,
428+
message: `apiGateway config is not applicable for ${data.targetType} target type`,
429+
path: ['apiGateway'],
430+
});
431+
}
418432
}
419433
if (data.targetType === 'mcpServer' && !data.compute && !data.endpoint) {
420434
ctx.addIssue({

0 commit comments

Comments
 (0)