Infer a tool call type from a single tool.
Works with tools created via tool() from @langchain/core/tools.
For DynamicStructuredTool, this extracts the input type from the _call method, which is the most reliable source as it's the pre-computed input type.
ToolCallFromTool: T extends __type InferToolInput<
T
> extends Args Args extends never never : Args extends Record<string, any> __type : never : never : neverimport { tool } from "@langchain/core/tools";
import { z } from "zod";
const getWeather = tool(
async ({ location }) => `Weather in ${location}`,
{ name: "get_weather", schema: z.object({ location: z.string() }) }
);
// Infer: { name: "get_weather"; args: { location: string }; id?: string; type?: "tool_call" }
type WeatherToolCall = ToolCallFromTool<typeof getWeather>;