Skip to content

Commit ddade59

Browse files
noritaka1166scottdensmore
authored andcommitted
chore: fix typo in mcp-client (google-gemini#1555)
Co-authored-by: Scott Densmore <[email protected]>
1 parent d422c50 commit ddade59

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

packages/core/src/tools/mcp-client.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
afterEach,
1515
Mocked,
1616
} from 'vitest';
17-
import { discoverMcpTools, sanatizeParameters } from './mcp-client.js';
17+
import { discoverMcpTools, sanitizeParameters } from './mcp-client.js';
1818
import { Schema, Type } from '@google/genai';
1919
import { Config, MCPServerConfig } from '../config/config.js';
2020
import { DiscoveredMCPTool } from './mcp-tool.js';
@@ -538,22 +538,22 @@ describe('discoverMcpTools', () => {
538538
});
539539
});
540540

541-
describe('sanatizeParameters', () => {
541+
describe('sanitizeParameters', () => {
542542
it('should do nothing for an undefined schema', () => {
543543
const schema = undefined;
544-
sanatizeParameters(schema);
544+
sanitizeParameters(schema);
545545
});
546546

547547
it('should remove default when anyOf is present', () => {
548548
const schema: Schema = {
549549
anyOf: [{ type: Type.STRING }, { type: Type.NUMBER }],
550550
default: 'hello',
551551
};
552-
sanatizeParameters(schema);
552+
sanitizeParameters(schema);
553553
expect(schema.default).toBeUndefined();
554554
});
555555

556-
it('should recursively sanatize items in anyOf', () => {
556+
it('should recursively sanitize items in anyOf', () => {
557557
const schema: Schema = {
558558
anyOf: [
559559
{
@@ -563,22 +563,22 @@ describe('sanatizeParameters', () => {
563563
{ type: Type.NUMBER },
564564
],
565565
};
566-
sanatizeParameters(schema);
566+
sanitizeParameters(schema);
567567
expect(schema.anyOf![0].default).toBeUndefined();
568568
});
569569

570-
it('should recursively sanatize items in items', () => {
570+
it('should recursively sanitize items in items', () => {
571571
const schema: Schema = {
572572
items: {
573573
anyOf: [{ type: Type.STRING }],
574574
default: 'world',
575575
},
576576
};
577-
sanatizeParameters(schema);
577+
sanitizeParameters(schema);
578578
expect(schema.items!.default).toBeUndefined();
579579
});
580580

581-
it('should recursively sanatize items in properties', () => {
581+
it('should recursively sanitize items in properties', () => {
582582
const schema: Schema = {
583583
properties: {
584584
prop1: {
@@ -587,7 +587,7 @@ describe('sanatizeParameters', () => {
587587
},
588588
},
589589
};
590-
sanatizeParameters(schema);
590+
sanitizeParameters(schema);
591591
expect(schema.properties!.prop1.default).toBeUndefined();
592592
});
593593

@@ -614,7 +614,7 @@ describe('sanatizeParameters', () => {
614614
},
615615
},
616616
};
617-
sanatizeParameters(schema);
617+
sanitizeParameters(schema);
618618
expect(schema.properties!.prop1.items!.default).toBeUndefined();
619619
const nestedProp =
620620
schema.properties!.prop2.anyOf![0].properties!.nestedProp;

packages/core/src/tools/mcp-client.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ async function connectAndDiscover(
304304
toolNameForModel.slice(0, 28) + '___' + toolNameForModel.slice(-32);
305305
}
306306

307-
sanatizeParameters(funcDecl.parameters);
307+
sanitizeParameters(funcDecl.parameters);
308308

309309
// Ensure parameters is a valid JSON schema object, default to empty if not.
310310
const parameterSchema: Record<string, unknown> =
@@ -362,23 +362,23 @@ async function connectAndDiscover(
362362
}
363363
}
364364

365-
export function sanatizeParameters(schema?: Schema) {
365+
export function sanitizeParameters(schema?: Schema) {
366366
if (!schema) {
367367
return;
368368
}
369369
if (schema.anyOf) {
370370
// Vertex AI gets confused if both anyOf and default are set.
371371
schema.default = undefined;
372372
for (const item of schema.anyOf) {
373-
sanatizeParameters(item);
373+
sanitizeParameters(item);
374374
}
375375
}
376376
if (schema.items) {
377-
sanatizeParameters(schema.items);
377+
sanitizeParameters(schema.items);
378378
}
379379
if (schema.properties) {
380380
for (const item of Object.values(schema.properties)) {
381-
sanatizeParameters(item);
381+
sanitizeParameters(item);
382382
}
383383
}
384384
}

0 commit comments

Comments
 (0)