How AI tool calling works (40 lines of vanilla JavaScript)
stephenblum
14 points
8 comments
September 15, 2026
Related Discussions
Found 5 related stories in 70.2ms across 6,718 title embeddings via pgvector HNSW
- AI, Tools and Transformation firexcy · 17 pts · September 06, 2026 · 55% similar
- Making erikschoster · 317 pts · July 22, 2026 · 52% similar
- Stop saying that AI is just a tool and it only matters how it is used cratermoon · 20 pts · July 16, 2026 · 51% similar
- If AI Writes All the Code, What Do the Programmers Do? ingve · 24 pts · July 28, 2026 · 51% similar
- AI by Hand sans_souse · 257 pts · August 14, 2026 · 51% similar
Discussion Highlights (3 comments)
sebiandev
AI slop warning
ramon156
Thank you Claude, very cool!
stratos123
The writing is slop. It doesn't mention a detail I have seen people actually not get: that LLMs wrap tool calls in special tokens, so they are "out of band" and can't be mistaken with normal output. It also spends an entire section trying to convey that large tools waste tokens: A read_file that returns an 8k-token source file on turn 2 of a ten-turn agent gets resent on the eight requests that follow: 8 × 8k = +64k input tokens, $0.32, from one tool result. but surely that's wrong - it's part of the same conversation, it only gets processed once and then cached. Otherwise doing long conversations would always cost an amount quadratic with length.