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:
parent
dcf708d892
commit
b2326afea6
1 changed files with 71 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue