Skip to content

Commit ce6cfda

Browse files
ihor-sokoliukclaudecodex
committed
fix(types): drop safesearch schema default so omitted value uses instance default (BUG-006)
Post-review (Codacy + Copilot): the safesearch schema's `default: "0"` can cause some MCP clients to auto-fill "0" and override the operator/instance default (SEARXNG_DEFAULT_SAFESEARCH or the SearXNG instance default), which contradicts the documented "default: instance setting" behavior. Remove the schema default — an omitted safesearch now reaches the server as undefined and the instance/operator default applies. Tests updated to assert no default is present. type:"string" and enum:["0","1","2"] unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Co-Authored-By: Codex <noreply@openai.com>
1 parent 4a54fc2 commit ce6cfda

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

__tests__/integration/mcp-handlers.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ async function runTests() {
163163
const safesearchSchema = searchProps.safesearch as Record<string, unknown>;
164164
assert.equal(safesearchSchema.type, 'string');
165165
assert.deepEqual(safesearchSchema.enum, ['0', '1', '2']);
166-
assert.equal(safesearchSchema.default, '0');
166+
assert.equal(safesearchSchema.default, undefined);
167+
assert.ok(!Object.hasOwn(safesearchSchema, 'default'));
167168
assert.ok(!(safesearchSchema.enum as unknown[]).some((value) => typeof value === 'number'));
168169

169170
const suggestionsTool = result.tools.find((t) => t.name === 'searxng_search_suggestions');

__tests__/unit/types.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ async function runTests() {
8383
assert.ok(properties.time_range.enum.includes('week'));
8484
assert.equal(properties.safesearch.type, 'string');
8585
assert.deepEqual(properties.safesearch.enum, ['0', '1', '2']);
86-
assert.equal(properties.safesearch.default, '0');
86+
assert.equal(properties.safesearch.default, undefined);
87+
assert.ok(!Object.hasOwn(properties.safesearch, 'default'));
8788
assert.ok(!properties.safesearch.enum.some((value: unknown) => typeof value === 'number'));
8889
assert.equal(properties.min_score.type, 'number');
8990
assert.equal(properties.min_score.minimum, 0);

src/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ export const WEB_SEARCH_TOOL: Tool = {
216216
description:
217217
"Safe search filter level (0: None, 1: Moderate, 2: Strict)",
218218
enum: ["0", "1", "2"],
219-
default: "0",
220219
},
221220
min_score: {
222221
type: "number",

0 commit comments

Comments
 (0)