Skip to content

fix: Capture anthropic server tool use inputs for streaming APIs#1776

Merged
Luca Forstner (lforst) merged 14 commits intomainfrom
lforst/anthropic-server-tools
Apr 13, 2026
Merged

fix: Capture anthropic server tool use inputs for streaming APIs#1776
Luca Forstner (lforst) merged 14 commits intomainfrom
lforst/anthropic-server-tools

Conversation

@lforst
Copy link
Copy Markdown
Member

Fixes #1660

Comment on lines +315 to +329
if (contentBlock.type === "tool_use") {
contentBlocks[index] = {
type: "tool_use",
id: contentBlock.id,
name: contentBlock.name,
input: parsedInput,
};
} else {
contentBlocks[index] = {
type: "server_tool_use",
id: contentBlock.id,
name: contentBlock.name,
input: parsedInput,
};
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isToolUseLikeContentBlock narrows, we can just do

contentBlocks[index] = {
  type: contentBlock.type,
  id: contentBlock.id,
  name: contentBlock.name,
  input: parsedInput,
};

}) satisfies Json;
});

if (options?.dropEmptyOutputTextMessages) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change, related to a flake?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's just about normalization across versions

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding a comment

…er-tools

# Conflicts:
#	e2e/scenarios/openai-instrumentation/assertions.ts
…er-tools

# Conflicts:
#	e2e/scenarios/anthropic-instrumentation/assertions.ts
#	e2e/scenarios/anthropic-instrumentation/scenario.anthropic-v0273.mjs
#	e2e/scenarios/anthropic-instrumentation/scenario.anthropic-v0273.ts
#	e2e/scenarios/anthropic-instrumentation/scenario.anthropic-v0390.mjs
#	e2e/scenarios/anthropic-instrumentation/scenario.anthropic-v0390.ts
#	e2e/scenarios/anthropic-instrumentation/scenario.impl.mjs
#	e2e/scenarios/anthropic-instrumentation/scenario.test.ts
@lforst Luca Forstner (lforst) merged commit 9ad2d5c into main Apr 13, 2026
49 checks passed
@lforst Luca Forstner (lforst) deleted the lforst/anthropic-server-tools branch April 13, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Anthropic server-side tool content blocks (server_tool_use, web_search_tool_result) dropped in streaming instrumentation

2 participants