The tool() helper is a modern factory function that creates either a DynamicTool or DynamicStructuredTool behind the scenes, automatically handling runtime features like LangGraph state injection and cancellation. DynamicStructuredTool is a concrete class for structured argument tools with schema validation, while DynamicTool is a simpler class for tools that accept a single string input.
In LangChain, you have multiple ways to create tools, each offering different levels of abstraction and control. The tool() helper is the recommended high-level factory function that simplifies tool creation. DynamicStructuredTool is a concrete class for tools with structured, multi-parameter inputs validated by a schema, and DynamicTool is a simpler class for tools that accept a single string input.
The tool() helper is a higher‑level factory that builds either a DynamicTool or DynamicStructuredTool for you. It's the recommended approach for most use cases because it automatically wires in newer runtime features such as state injection from LangGraph, context propagation, cancellation (AbortSignal), and streaming (runtime.writer).
Less boilerplate; consistent pattern across projects
Automatically gains new LangChain/LangGraph runtime features without code changes
Easier onboarding for new developers following official docs
DynamicStructuredTool is a concrete class that extends StructuredTool. It is designed for tools that accept structured data (multiple named arguments) validated against a Zod or JSON schema. You instantiate it directly with a configuration object containing name, description, schema, and func.
More explicit and low-level control
Useful when you need a custom subclass or to override parts of StructuredTool
Appropriate for building lower‑level libraries where fine‑grained control is needed
DynamicTool is a simpler class for tools that accept a single string input. It uses a default StringInputToolSchema and is useful for wrapping legacy APIs or functions that operate on a single query string.
tool(): Modern factory; creates DynamicTool/DynamicStructuredTool; recommended for most code; automatically handles runtime features (LangGraph state, cancellation, context)
DynamicStructuredTool: Low-level class; for structured, multi-parameter input; requires manual instantiation; use when you need custom subclassing
DynamicTool: Low-level class; for simple single-string input; less common; use for legacy APIs or simple wrappers
For the LLM, both approaches look identical—they expose the same name, description, and argument schema. The differences are in developer ergonomics and runtime integration rather than what the model sees. The official recommendation for maintainable, future‑proof code is to standardize on the tool() helper for all new tools and gradually migrate existing DynamicStructuredTool usages to this pattern.