LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangChain
  • Universal
  • Hub
  • Node
  • Load
  • Serializable
  • Encoder Backed
  • File System
  • In Memory
LangChain Core
  • Agents
  • Caches
  • Base
  • Dispatch
  • Web
  • Manager
  • Promises
  • Chat History
  • Context
  • Base
  • Langsmith
  • Documents
  • Embeddings
  • Errors
  • Example Selectors
  • Indexing
  • Base
  • Chat Models
  • Llms
  • Profile
  • Load
  • Serializable
  • Memory
  • Messages
  • Tool
  • Output Parsers
  • Openai Functions
  • Openai Tools
  • Outputs
  • Prompt Values
  • Prompts
  • Retrievers
  • Document Compressors
  • Runnables
  • Graph
  • Singletons
  • Stores
  • Structured Query
  • Tools
  • Base
  • Console
  • Log Stream
  • Run Collector
  • Tracer Langchain
  • Stream
  • Async Caller
  • Chunk Array
  • Context
  • Env
  • Event Source Parse
  • Format
  • Function Calling
  • Hash
  • Json Patch
  • Json Schema
  • Math
  • Ssrf
  • Stream
  • Testing
  • Tiktoken
  • Types
  • Vectorstores
Text Splitters
MCP Adapters
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangChain
UniversalHubNodeLoadSerializableEncoder BackedFile SystemIn Memory
LangChain Core
AgentsCachesBaseDispatchWebManagerPromisesChat HistoryContextBaseLangsmithDocumentsEmbeddingsErrorsExample SelectorsIndexingBaseChat ModelsLlmsProfileLoadSerializableMemoryMessagesToolOutput ParsersOpenai FunctionsOpenai ToolsOutputsPrompt ValuesPromptsRetrieversDocument CompressorsRunnablesGraphSingletonsStoresStructured QueryToolsBaseConsoleLog StreamRun CollectorTracer LangchainStreamAsync CallerChunk ArrayContextEnvEvent Source ParseFormatFunction CallingHashJson PatchJson SchemaMathSsrfStreamTestingTiktokenTypesVectorstores
Text Splitters
MCP Adapters
Language
Theme
JavaScript@langchain/coreutilstypesisSimpleStringZodSchema
Functionā—Since v1.0

isSimpleStringZodSchema

Determines if the provided Zod schema should be treated as a simple string schema that maps to DynamicTool. This aligns with the type-level constraint of InteropZodType<string | undefined> which only matches basic string schemas. If the provided schema is just z.string(), we can make the determination that the tool is just a generic string tool that doesn't require any input validation.

This function only returns true for basic ZodString schemas, including:

  • Basic string schemas (z.string())
  • String schemas with validations (z.string().min(1), z.string().email(), etc.)

This function returns false for everything else, including:

  • String schemas with defaults (z.string().default("value"))
  • Branded string schemas (z.string().brand<"UserId">())
  • String schemas with catch operations (z.string().catch("default"))
  • Optional/nullable string schemas (z.string().optional())
  • Transformed schemas (z.string().transform() or z.object().transform())
  • Object or record schemas, even if they're empty
  • Any other schema type
Copy
isSimpleStringZodSchema(
  schema: unknown
): schema is InteropZodType<string | undefined, string | undefined>

Parameters

NameTypeDescription
schema*unknown

The Zod schema to check.

View source on GitHub