module

Anthropic::StainlessHelper

Single source of truth for the x-stainless-helper telemetry header.

The Anthropic backend uses this header to attribute requests to specific SDK helpers (tool runners, middleware, MCP helpers, etc.). This module centralizes the header key and a closed vocabulary of tag values so call sites can't typo them, and provides append semantics so multiple helpers composing on one request combine into a single comma-separated value rather than clobbering each other.

Constants

BETA_TOOL_RUNNER = "BetaToolRunner"

Closed vocabulary of helper tag values.

COMPACTION = "compaction"
FALLBACK_REFUSAL_MIDDLEWARE = "fallback-refusal-middleware"
HEADER = "x-stainless-helper"
SESSION_TOOL_RUNNER = "session-tool-runner"

Class methods

header(value : String) : Hash(String, String)

Convenience: build a single-entry header hash for one helper tag.

Source
merge_helper_header(headers : Hash(String, String) | Nil, value : String) : Hash(String, String)

Merge a helper tag into an existing headers hash with append semantics.

If the header is already present, the new value is appended (preserving order, dropping duplicates); otherwise it is set. Returns a new hash.

Source
merge_helper_header(headers : HTTP::Headers, value : String) : HTTP::Headers

Merge a helper tag into an HTTP::Headers (mutates and returns it).

Source