Skip to content

Commit d837ddf

Browse files
author
CHANGE_ME
committed
nvm, mcp tool search, tmux, etc
what a day! so many things that I learned.
1 parent b8fad48 commit d837ddf

7 files changed

Lines changed: 78 additions & 1 deletion

journals/2026_03_16.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
- # [[Filed]]
2+
- [[nvf]]
3+
- [[Person/raf]]
24
- [[MCP/Tool Search]]
35
- [[nvim/Q/How can I quickly collapse and expand a block in nvim?]]
46
- [[nvim-ufo]]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
- # In what sense are [[MCP]] tools "loaded on-demand" in [[Claude Code]]?
2+
- ## Answer
3+
- [[AI/Response]]
4+
- "Loaded on-demand" refers to a specific [[Claude Code]] feature called **MCP Tool Search**. [Official docs: Scale with MCP Tool Search](https://code.claude.com/docs/en/mcp#scale-with-mcp-tool-search)
5+
- **How it works** (from official docs):
6+
- Claude Code automatically enables Tool Search when MCP tool descriptions would consume more than **10% of the context window**
7+
- When triggered: MCP tools are **deferred** rather than loaded into context upfront
8+
- Claude uses a built-in search tool (`MCPSearch`) to discover relevant MCP tools when it needs them
9+
- Only the tools Claude actually needs are then loaded into context
10+
- **Why?** Tool definitions from many MCP servers can be verbose and numerous — loading them all upfront could consume a significant slice of the context window even when most are never used in a session.
11+
- **Default behaviour**: Enabled by default (except when `ANTHROPIC_BASE_URL` points to a non-first-party host, since most proxies don't forward `tool_reference` blocks). Requires Sonnet 4+ or Opus 4+; Haiku models don't support it.
12+
- **Control via env var** `ENABLE_TOOL_SEARCH`:
13+
- `(unset)` — enabled by default
14+
- `auto` — activates when MCP tools exceed 10% of context
15+
- `auto:<N>` — custom threshold (e.g. `auto:5` for 5%)
16+
- `true` — always on, including non-first-party base URLs
17+
- `false` — disabled; all MCP tools loaded upfront
18+
- You can also disable the search tool specifically: `permissions.deny: ["MCPSearch"]`
19+
- ## Related
20+
- [[MCP]]
21+
- [[Claude Code]]

pages/MCP___Tool Search.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
tags:: [[MCP]], [[AI/Coding]], [[Claude Code]], [[OpenAI]]
2+
3+
- # MCP Tool Search
4+
- Both [[Anthropic]] ([[Claude Code]]) and [[OpenAI]] have independently shipped a mechanism for loading [[MCP]] tool definitions **on-demand** rather than injecting all of them into the context window upfront — directly addressing the context bloat problem described in [[MCP/Concept/On-Demand Tool Loading]].
5+
- ## The Problem
6+
- Geoffrey Huntley's [too many model context protocol servers and LLM allocations on the dance floor](https://simonwillison.net/2025/Aug/22/too-many-mcps/) (via [[Person/Simon Willison]]) crystallised the issue:
7+
- Claude's 200k-token window shrinks to ~176k after system prompts in tools like Amp or Cursor
8+
- The GitHub MCP server alone consumes ~55,000 of those tokens
9+
- Multiple MCP servers stack this penalty; LLMs also perform worse when irrelevant information fills the prompt
10+
- ## Anthropic's Solution: MCP Tool Search (Claude Code)
11+
- [Scale with MCP Tool Search - Claude Docs](https://code.claude.com/docs/en/mcp#scale-with-mcp-tool-search)
12+
- Enabled by default in [[Claude Code]] when MCP tool schemas would exceed **10% of the context window**
13+
- When triggered:
14+
- MCP tools are **deferred** — not loaded into context upfront
15+
- Claude uses a built-in `MCPSearch` tool to discover relevant tools when it needs them
16+
- Only the tools actually needed are loaded into context for that turn
17+
- Controlled via `ENABLE_TOOL_SEARCH` env var; requires Sonnet 4+ or Opus 4+
18+
- See also: [[Claude Code/Q/In what sense are MCP tools loaded on-demand]]
19+
- ## OpenAI's Solution: Tool Search (GPT-5.4+)
20+
- [Tool Search - OpenAI API Docs](https://developers.openai.com/api/docs/guides/tools-tool-search)
21+
- Introduced with `gpt-5.4`; tools marked `"defer_loading": true` are not injected upfront
22+
- Two modes:
23+
- **Hosted**: OpenAI's servers handle discovery automatically; model receives a `tool_search_call` then `tool_search_output`
24+
- **Client-executed**: The application controls discovery logic and returns matching tools via `tool_search_output`
25+
- Loaded tools are injected at the **end** of the context window, preserving cache across requests
26+
- Works with functions, namespaces, or MCP servers
27+
- ## Significance
28+
- Both implementations converge on the same architecture: tools as a **searchable index** rather than a flat pre-loaded list
29+
- This makes large MCP inventories (dozens of servers, hundreds of tools) practical without the context tax
30+
- Likely to become a baseline expectation for AI coding tools and agent frameworks going forward

pages/Person___raf.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
alias:: [[Username/NotAShelf]]
2+
tags:: [[Coder]]
3+
4+
- # [raf](https://notashelf.dev)
5+
- > Political Scientist, Open source advocate, (dys)functional/high-level programmer. @NixOS hacker and nixpkgs contributor.
6+
- [[Person/raf/GitHub]] https://github.com/NotAShelf
7+
- [[Person/raf/Blog]] https://notashelf.dev/posts
8+
- [[Person/raf/TwitX]] https://twitter.com/NotAShelf
9+
- Maintains [[nvf]] and many other [[NixOS]] and [[Nix]] ecosystem tools
10+
- ## My Notes
11+
- Their [[GitHub]] profile is a great example of a well-configured GitHub about page / person README page.

pages/nvf.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1-
- [NotAShelf/nvf: Modular, extensible and distro-agnostic Neovim configuration framework for Nix/NixOS](https://github.com/NotAShelf/nvf)
1+
alias:: [[Person/raf/GitHub/nvf]]
2+
logseq-entity:: [[Logseq/Entity/software-project]]
3+
created-by:: [[Person/raf]]
4+
5+
- # [nvf](https://github.com/NotAShelf/nvf)
6+
- A highly modular, extensible, and distro-agnostic [[nvim]] configuration framework for [[Nix]]/[[NixOS]].
7+
- Documentation: https://nvf.notashelf.dev
8+
- ## Key Features
9+
- Declarative [[nvim]] configuration using [[Nix]]
10+
- Supports standalone, NixOS module, and Home-Manager module installation
11+
- Prebuilt configs: "Nix" (Nix LSP) and "Maximal" (full LSP + plugins)
12+
- Portable — test configurations without permanent installation via [[Nix]]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- ((697d04c1-9250-4237-953e-dd6d4160380c))

pages/tmux___Tutorial___26___01___Oboe - Mastering AI Dev Workflows.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
- [[Tip]] Many users find the default [[tmux/Keyshort/Prefix]] prefix key, `Ctrl+b`, a bit awkward. A common alternative is `Ctrl+a`, which is easier to reach
44
- [[tmux/How To/Reload Config]]
55
- use [[tmux/Keyshort/Prefix]] then `:` then type `source-file ~/.tmux.conf` and press Enter.
6+
id:: 697d04c1-9250-4237-953e-dd6d4160380c
67
-

0 commit comments

Comments
 (0)