---
title: "Lazy Tool Discovery: Scaling AI Tool Systems Without Drowning in Tokens"
url: https://daily.dev/posts/lazy-tool-discovery-scaling-ai-tool-systems-without-drowning-in-tokens-erx5dnnu3
source_url: https://tanstack.com/blog/tanstack-ai-lazy-tool-discovery
type: article
source: "TanStack"
published: 2026-08-23T12:24:03.270Z
updated: 2026-08-23T12:50:44.787Z
tags: ["ai-agents", "typescript"]
reading_time: 4
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Lazy Tool Discovery: Scaling AI Tool Systems Without Drowning in Tokens

**[TanStack](https://daily.dev/sources/tanstack-blog)** · 4 min read · 0 upvotes · 0 comments

## Summary

TanStack AI has released lazy tool discovery, a feature that lets LLMs discover tool definitions on demand rather than receiving all tool schemas upfront. Marking a tool as lazy: true withholds its definition from the model and replaces it with a synthetic discovery tool listing available lazy tool names; the model can query this discovery tool to learn a tool's schema before calling it. This reduces token usage, context window bloat, and tool-selection confusion in systems with many tools (e.g., a 30-tool customer support agent). The feature is fully opt-in and backward compatible — if no tools are marked lazy, behavior is unchanged. A guitar store chat example shows eager tools (core actions) mixed with lazy tools (comparison, financing) that get discovered only when needed. The team suggests tools used in fewer than 30% of conversations are good lazy candidates, and the feature is available now in @tanstack/ai.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://tanstack.com/blog/tanstack-ai-lazy-tool-discovery>

## Questions this post answers

### What is lazy tool discovery in TanStack AI and how does it work?

Lazy tool discovery is a TanStack AI feature that lets an LLM discover tool definitions on demand instead of receiving them all upfront. Marking a tool with lazy: true withholds it from the initial request; a synthetic tool called __lazy__tool__discovery__ lists the available lazy tool names, and the model calls it to learn a tool's schema before invoking it, saving tokens on requests that don't need that tool.

_Developers scaling multi-tool AI agents can follow releases like this one on daily.dev to manage token costs._

### How do I mark a tool as lazy in TanStack AI's toolDefinition function?

Add lazy: true as a property inside the toolDefinition object alongside name, description, and inputSchema. For example, a searchProducts tool with lazy: true is withheld from the LLM's initial tool list until the model explicitly discovers it through the synthetic __lazy__tool__discovery__ tool, at which point its full schema becomes available for use.

_Track granular API details like this on daily.dev when integrating new TanStack AI features._

### When should I use lazy tools versus eager tools in an AI agent with many tools?

Lazy tools work best for secondary or infrequently used features, while eager (default) tools should stay for core, always-needed functionality. A practical rule of thumb is that if a tool is used in less than 30% of conversations, it's a strong candidate for lazy: true, since the extra discovery round-trip costs less than sending its definition on every request.

_Developers weighing tool-design tradeoffs in AI agents can compare approaches like this on daily.dev._

## Similar posts on daily.dev

- [Spring AI’s Dynamic Tool Discovery](https://daily.dev/posts/spring-ai-s-dynamic-tool-discovery-k2apeohgr) · Baeldung · 0 upvotes · 0 comments
- [Smart Tool Selection: Achieving 34-64% Token Savings with Spring AI's Dynamic Tool Discovery](https://daily.dev/posts/smart-tool-selection-achieving-34-64-token-savings-with-spring-ai-s-dynamic-tool-discovery-n1bvjlpdj) · Spring · 2 upvotes · 0 comments

---

Tags: [#ai-agents](https://daily.dev/tags/ai-agents), [#typescript](https://daily.dev/tags/typescript)

[View this post on daily.dev](https://daily.dev/posts/lazy-tool-discovery-scaling-ai-tool-systems-without-drowning-in-tokens-erx5dnnu3)
