Improve Function Call argument validation and typing (#2881)

Co-authored-by: N. Taylor Mullen <ntaylormullen@google.com>
This commit is contained in:
Tommaso Sciortino
2025-07-07 23:48:44 -07:00
committed by GitHub
parent 137ffec3f6
commit 4dab31f1c8
22 changed files with 239 additions and 246 deletions

View File

@@ -5,19 +5,20 @@
*/
import { BaseTool, ToolResult } from './tools.js';
import { FunctionDeclaration, Type } from '@google/genai';
import * as fs from 'fs/promises';
import * as path from 'path';
import { homedir } from 'os';
const memoryToolSchemaData = {
const memoryToolSchemaData: FunctionDeclaration = {
name: 'save_memory',
description:
'Saves a specific piece of information or fact to your long-term memory. Use this when the user explicitly asks you to remember something, or when they state a clear, concise fact that seems important to retain for future interactions.',
parameters: {
type: 'object',
type: Type.OBJECT,
properties: {
fact: {
type: 'string',
type: Type.STRING,
description:
'The specific fact or piece of information to remember. Should be a clear, self-contained statement.',
},
@@ -98,7 +99,7 @@ function ensureNewlineSeparation(currentContent: string): string {
}
export class MemoryTool extends BaseTool<SaveMemoryParams, ToolResult> {
static readonly Name: string = memoryToolSchemaData.name;
static readonly Name: string = memoryToolSchemaData.name!;
constructor() {
super(
MemoryTool.Name,