Skip to content

Commit 745991b

Browse files
authored
Merge pull request modelcontextprotocol#357 from OpenLinkSoftware/main
When argument to a tool is not specified it should not be default and send via MCP request as a NULL value.
2 parents cdab12a + 42b0a77 commit 745991b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

client/src/utils/__tests__/schemaUtils.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ describe("generateDefaultValue", () => {
5151

5252
test("generates null for non-required primitive types", () => {
5353
expect(generateDefaultValue({ type: "string", required: false })).toBe(
54-
null,
54+
undefined,
5555
);
5656
expect(generateDefaultValue({ type: "number", required: false })).toBe(
57-
null,
57+
undefined,
5858
);
5959
expect(generateDefaultValue({ type: "boolean", required: false })).toBe(
60-
null,
60+
undefined,
6161
);
6262
});
6363

client/src/utils/schemaUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function generateDefaultValue(schema: JsonSchemaType): JsonValue {
1313
if (!schema.required) {
1414
if (schema.type === "array") return [];
1515
if (schema.type === "object") return {};
16-
return null;
16+
return undefined;
1717
}
1818

1919
switch (schema.type) {

0 commit comments

Comments
 (0)