diff --git a/lib/fetch-wrapper/formats/gemini.ts b/lib/fetch-wrapper/formats/gemini.ts index c1c0feb..6510290 100644 --- a/lib/fetch-wrapper/formats/gemini.ts +++ b/lib/fetch-wrapper/formats/gemini.ts @@ -87,9 +87,10 @@ export const geminiFormat: FormatDescriptor = { const toolCallId = positionMapping.get(positionKey) if (toolCallId) { + const metadata = state.toolParameters.get(toolCallId.toLowerCase()) outputs.push({ id: toolCallId.toLowerCase(), - toolName: funcName + toolName: metadata?.tool }) } } diff --git a/lib/fetch-wrapper/handler.ts b/lib/fetch-wrapper/handler.ts index ce7a476..db18883 100644 --- a/lib/fetch-wrapper/handler.ts +++ b/lib/fetch-wrapper/handler.ts @@ -71,6 +71,7 @@ export async function handleFormat( const sessionId = ctx.state.lastSeenSessionId const protectedSet = new Set(ctx.config.protectedTools) if (sessionId) { + await ensureSessionRestored(ctx.state, sessionId, ctx.logger) await syncToolCache(ctx.client, sessionId, ctx.state, ctx.toolTracker, protectedSet, ctx.logger) }