import type { FunctionCall } from "@google/genai"; import * as search_posts from "./search_posts"; import type { infer as z_infer } from "zod"; const validation_mappings = { "search_posts": search_posts.validator, } as const; export const declarations = [ { urlContext: {} }, { googleSearch: {} }, /* { functionDeclarations: [ search_posts.definition, ], }, */ ]; type ToolName = keyof typeof validation_mappings; export async function handler(call: FunctionCall & { name: ToolName }) { const parsedArgs = validation_mappings[call.name].parse(call.args); switch (call.name) { case "search_posts": return await search_posts.handler( parsedArgs as z_infer, ); } }