Function: toolResultFrom()
toolResultFrom<
TTools>(segment,tools): { [K in string | number | symbol]: TTools[K] extends ZodToolDefinition<TSchema, TReturn> ? MatchedToolResult<K, InferOutput<TSchema>, TReturn> : never }[keyofTTools] |undefined
Defined in: packages/core/src/segments/typed-tool-call.ts:97
Narrow a ToolCallSegment against a set of known tool definitions, matching
by name — unlike typedToolCall(), which trusts the caller to hand it the
right definition, this checks segment.name against each candidate and
returns undefined if none match. Use it when a segment could belong to
any tool in a shared map (e.g. a bot's full tools set) instead of one
you've already singled out.
Type Parameters
TTools
TTools extends Record<string, ZodToolDefinition<any, any>>
Parameters
segment
tools
TTools
Returns
{ [K in string | number | symbol]: TTools[K] extends ZodToolDefinition<TSchema, TReturn> ? MatchedToolResult<K, InferOutput<TSchema>, TReturn> : never }[keyof TTools] | undefined