Process results programmatically changedagents-and-tools/tool-use/programmatic-tool-calling
Nearest release: v2.1.309, published an hour before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+19added
Lines−29removed
From line
878
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits18to this page, all time
The whole hunk
from line 878, old and new numbered
/
from line 878
878878 },
879879 Messages: []anthropic.MessageParam{
880880 anthropic.NewUserMessage(anthropic.NewTextBlock("Query customer purchase history from the last quarter and identify our top 5 customers by revenue")),
881 {OfAssistant: &anthropic.AssistantMessageParam{
882 Content: []anthropic.ContentBlockParamUnion{
883 anthropic.NewTextBlock("I'll query the purchase history and analyze the results."),
884 {OfServerToolUse: &anthropic.ServerToolUseBlockParam{
885 ID: "srvtoolu_abc123",
886 Name: anthropic.ServerToolUseBlockParamNameCodeExecution,
887 Input: map[string]any{"code": "..."},
888 }},
889 {OfToolUse: &anthropic.ToolUseBlockParam{
890 ID: "toolu_def456",
891 Name: "query_database",
892 Input: map[string]any{"sql": "<sql>"},
893 Caller: anthropic.ServerToolUseBlockParamCallerUnion{
894 OfCodeExecution20260120: &anthropic.ServerToolCaller20260120Param{
895 ToolID: "srvtoolu_abc123",
896 },
881 anthropic.NewAssistantMessage(
882 anthropic.NewTextBlock("I'll query the purchase history and analyze the results."),
883 anthropic.NewServerToolUseBlock("srvtoolu_abc123", map[string]any{"code": "..."}, anthropic.ServerToolUseBlockParamNameCodeExecution),
884 anthropic.ContentBlockParamUnion{OfToolUse: &anthropic.ToolUseBlockParam{
885 ID: "toolu_def456",
886 Name: "query_database",
887 Input: map[string]any{"sql": "<sql>"},
888 Caller: anthropic.ToolUseBlockParamCallerUnion{
889 OfCodeExecution20260120: &anthropic.ServerToolCaller20260120Param{
890 ToolID: "srvtoolu_abc123",
897891 },
892 },
893 }},
894 ),
895 anthropic.NewUserMessage(anthropic.ContentBlockParamUnion{OfToolResult: &anthropic.ToolResultBlockParam{
896 ToolUseID: "toolu_def456",
897 Content: []anthropic.ToolResultBlockParamContentUnion{
898 {OfText: &anthropic.TextBlockParam{
899 Text: `[{"customer_id": "C1", "revenue": 45000}, {"customer_id": "C2", "revenue": 38000}, ...]`,
898900 }},
899901 },
900 }},
901 {OfUser: &anthropic.UserMessageParam{
902 Content: []anthropic.ContentBlockParamUnion{
903 {OfToolResult: &anthropic.ToolResultBlockParam{
904 ToolUseID: "toolu_def456",
905 Content: []anthropic.ToolResultBlockParamContentUnion{
906 {OfText: &anthropic.TextBlockParam{
907 Text: `[{"customer_id": "C1", "revenue": 45000}, {"customer_id": "C2", "revenue": 38000}, ...]`,
908 }},
909 },
910 }},
911 },
912 }},
902 }}),
913903 },
914904 // Same tools array as the original request
915905 Tools: []anthropic.ToolUnionParam{
No line in this hunk matches that.