Skip to content

Commit d3ff6da

Browse files
ochafikclaude
andcommitted
Use .default() for threejs tool schema instead of .optional()
This exposes the default code and height values in the JSON Schema, allowing basic-host to auto-populate the input field with defaults. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 4b73b5f commit d3ff6da

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

examples/threejs-server/server.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,9 @@ const server = new McpServer({
151151
inputSchema: {
152152
code: z
153153
.string()
154-
.optional()
155-
.describe(
156-
"JavaScript code to render the 3D scene (defaults to a rotating cube demo)",
157-
),
158-
height: z
159-
.number()
160-
.int()
161-
.positive()
162-
.optional()
163-
.describe("Height in pixels (default: 400)"),
154+
.default(DEFAULT_THREEJS_CODE)
155+
.describe("JavaScript code to render the 3D scene"),
156+
height: z.number().int().positive().default(400).describe("Height in pixels"),
164157
},
165158
_meta: { [RESOURCE_URI_META_KEY]: resourceUri },
166159
},
@@ -169,10 +162,7 @@ const server = new McpServer({
169162
content: [
170163
{
171164
type: "text",
172-
text: JSON.stringify({
173-
code: code || DEFAULT_THREEJS_CODE,
174-
height: height || 400,
175-
}),
165+
text: JSON.stringify({ code, height }),
176166
},
177167
],
178168
};

0 commit comments

Comments
 (0)