Skip to content

Instantly share code, notes, and snippets.

@terrhorn
terrhorn / mcp-tool-call-flow.md
Created March 11, 2026 15:08
MCP Tool Call Flow: Specification → SDK → Server

MCP Tool Call Flow: Specification → SDK → Server

How a tool call flows through the Model Context Protocol, traced across the specification, TypeScript SDK, and reference server implementations.


Phase 1: Capability Negotiation (Initialization)

During initialize, the server declares it supports tools:

@terrhorn
terrhorn / research-comparison.md
Created March 11, 2026 15:06
Comparative critique: MCP Tool Call Flow research reports

Comparative Critique: MCP Tool Call Flow Research Reports

Two research reports trace how a tool call flows through the Model Context Protocol. This critique compares their depth, quality, and gaps.

Dimension Report A (mcp-tool-call-flow.md) Report B (how-does-a-tool-call-flow...)
Length ~450 lines ~700 lines (~32KB)
Structure Phase-based (4 phases) Layer-based (4 layers, 9 numbered steps)
Session 27ed82ad f349ea56

Keybase proof

I hereby claim:

  • I am terrhorn on github.
  • I am terrhorn (https://keybase.io/terrhorn) on keybase.
  • I have a public key whose fingerprint is DD56 9F81 4C96 C469 082E F882 3FF5 8ABD DDFB BAC5

To claim this, I am signing this object:

@terrhorn
terrhorn / batch_events.scala
Created February 16, 2016 17:44
Batch Events in KeenClient-Scala
val collectionName = "my_event_collection" // the name of your collection
val events = ArrayBuffer.empty[String] // an array buffer to hold all of the events that we'll batch
// populate the array with 5000 fake events
for(i <- 1 to 5000) {
events.append(s"""{"foo": { "count": $i, "bar": "baz"} }""")
}
// split events into 5 batches of 1000 events, and send each batch to Keen
for(batch <- events.grouped(1000)) {
@terrhorn
terrhorn / collection_counts.rb
Created February 12, 2015 22:46
Counts the total number of events in each collections for a given Project
require 'dotenv'
require 'keen'
Dotenv.load
# allow timeframe to be specified via the command line
# usage: ruby collection_counts.rb previous_7_days
if !ARGV[0].nil?
timeframe = ARGV[0]
end