Drop-in replacement for ChatGoogle that automatically adapts MCP tool schemas for Gemini function calling.

Use this class anywhere you would normally use ChatGoogle from @langchain/google/node:

import { ChatGoogleEx } from "@h1deya/langchain-google-ex";

const model = new ChatGoogleEx({
model: "gemini-2.5-flash",
apiKey: process.env.GOOGLE_API_KEY,
});

The public API intentionally stays small. Pass the original MCP tools to your LangChain agent; ChatGoogleEx transforms their schemas when LangChain binds tools to the model.

Hierarchy

  • ChatGoogleNode
    • ChatGoogleEx

Constructors

Methods

Constructors

Methods

  • Transforms MCP tool schemas for Gemini compatibility, then delegates to ChatGoogle.bindTools().

    This runs at binding time so LangChain keeps the original tool objects and their invocation behavior, while Gemini receives schemas with unsupported JSON Schema constructs removed or simplified.

    Parameters

    • tools: any[]
    • Optionalkwargs: Partial<BaseChatGoogleCallOptions>

    Returns Runnable<BaseMessage<MessageStructure<MessageToolSet>, MessageType>[], AIMessageChunk<MessageStructure<MessageToolSet>>, BaseChatGoogleCallOptions>