From 96239f4d84bc74cf71bac213ee98cc55200540af Mon Sep 17 00:00:00 2001 From: Mohammod Al Amin Ashik Date: Thu, 12 Feb 2026 23:06:23 +0800 Subject: [PATCH] feat: add default property to input schema definition Add `default` field to the input definition in the JSON schema, aligning the schema with the Rust types that already support it. Includes a schema validation test for inputs with defaults. Co-Authored-By: Claude Opus 4.6 --- schemas/server-definition.schema.json | 4 ++++ tests/schema-validation.test.js | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/schemas/server-definition.schema.json b/schemas/server-definition.schema.json index 52b7ee1..7d21e35 100644 --- a/schemas/server-definition.schema.json +++ b/schemas/server-definition.schema.json @@ -218,6 +218,10 @@ "type": "string", "description": "Help text for this input" }, + "default": { + "type": "string", + "description": "Default value for this input (used when user provides no value)" + }, "placeholder": { "type": "string", "description": "Placeholder text" diff --git a/tests/schema-validation.test.js b/tests/schema-validation.test.js index ff5c7d9..9b18a9d 100644 --- a/tests/schema-validation.test.js +++ b/tests/schema-validation.test.js @@ -50,6 +50,19 @@ describe("Server Definition Schema", () => { it.each([ { id: "com.example-test", name: "Test", transport: { type: "stdio", command: "echo" } }, { id: "com.example-remote", name: "Remote", transport: { type: "http", url: "https://example.com/mcp" } }, + { + id: "com.example-defaults", name: "Defaults Test", + transport: { + type: "stdio", command: "node", args: ["server.js"], + env: { "LOG_LEVEL": "${input:LOG_LEVEL}" }, + metadata: { + inputs: [ + { id: "LOG_LEVEL", label: "Log Level", type: "text", required: false, default: "info" }, + { id: "API_KEY", label: "API Key", type: "password", required: true, secret: true }, + ], + }, + }, + }, ])("validates valid server definition: $id", (data) => { expect(validate(data)).toBe(true); });