Skip to content

Commit f2d8541

Browse files
author
Lasim
committed
refactor: update value type definition to allow multiple types and make tools optional in global server schema
1 parent 4e36538 commit f2d8541

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

services/backend/src/routes/globalSettings/settings/bulk.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default async function bulkGlobalSettingsRoute(fastify: FastifyInstance)
4646
type: 'object',
4747
properties: {
4848
key: { type: 'string', minLength: 1, maxLength: 255, pattern: '^[a-zA-Z0-9._-]+$' },
49-
value: { oneOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }] },
49+
value: { type: ['string', 'number', 'boolean'] }, // Allow multiple types without oneOf
5050
type: { type: 'string', enum: ['string', 'number', 'boolean'] },
5151
description: { type: 'string' },
5252
encrypted: { type: 'boolean', default: false },

services/backend/src/routes/globalSettings/settings/create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default async function createGlobalSettingRoute(fastify: FastifyInstance)
3434
type: 'object',
3535
properties: {
3636
key: { type: 'string', minLength: 1, maxLength: 255, pattern: '^[a-zA-Z0-9._-]+$' },
37-
value: { oneOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }] },
37+
value: { type: ['string', 'number', 'boolean'] }, // Allow multiple types without oneOf
3838
type: { type: 'string', enum: ['string', 'number', 'boolean'] },
3939
description: { type: 'string' },
4040
encrypted: { type: 'boolean', default: false },

services/backend/src/routes/mcp/servers/create-global.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const createGlobalServerRequestSchema = z.object({
2828
tools: z.array(z.object({
2929
name: z.string().min(1, 'Tool name is required'),
3030
description: z.string().min(1, 'Tool description is required')
31-
})).min(1, 'At least one tool is required'),
31+
})).optional(),
3232

3333
// Optional fields
3434
long_description: z.string().optional(),
@@ -174,7 +174,6 @@ export default async function createGlobalServer(server: FastifyInstance) {
174174
},
175175
tools: {
176176
type: 'array',
177-
minItems: 1,
178177
items: {
179178
type: 'object',
180179
properties: {
@@ -223,7 +222,7 @@ export default async function createGlobalServer(server: FastifyInstance) {
223222
tags: { type: 'array', items: { type: 'string' } },
224223
featured: { type: 'boolean' }
225224
},
226-
required: ['name', 'description', 'language', 'runtime', 'claude_desktop_config', 'tools'],
225+
required: ['name', 'description', 'language', 'runtime', 'claude_desktop_config'],
227226
additionalProperties: false
228227
},
229228
// createSchema() for OpenAPI documentation
@@ -291,7 +290,7 @@ export default async function createGlobalServer(server: FastifyInstance) {
291290
runtime: requestData.runtime,
292291
runtime_min_version: requestData.runtime_min_version,
293292
installation_methods,
294-
tools: requestData.tools,
293+
tools: requestData.tools || [],
295294
resources: requestData.resources,
296295
prompts: requestData.prompts,
297296
visibility: 'global' as const,

0 commit comments

Comments
 (0)