fix(server): handle undefined arguments for tools with all optional params (#1404)

Co-authored-by: Felix Weinberger <3823880+felixweinberger@users.noreply.github.com>
Co-authored-by: Felix Weinberger <fweinberger@anthropic.com>
This commit is contained in:
suram 2026-01-24 03:36:40 +09:00 • committed by GitHub
commit b2326afea6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -271,7 +271,7 @@ export class McpServer {
// If that fails, use the schema directly (for union/intersection/etc)
const inputObj = normalizeObjectSchema(tool.inputSchema);
const schemaToParse = inputObj ?? (tool.inputSchema as AnySchema);
const parseResult = await safeParseAsync(schemaToParse, args);
const parseResult = await safeParseAsync(schemaToParse, args ?? {});
if (!parseResult.success) {
const error = 'error' in parseResult ? parseResult.error : 'Unknown error';
const errorMessage = getParseErrorMessage(error);