MCPcopy Create free account
hub / github.com/coder/coder / normalizeAssistantToolCallInputs

Function normalizeAssistantToolCallInputs

coderd/x/chatd/chatprompt/chatprompt.go:599–614  ·  view source on GitHub ↗
(
	parts []fantasy.MessagePart,
)

Source from the content-addressed store, hash-verified

597}
598
599func normalizeAssistantToolCallInputs(
600 parts []fantasy.MessagePart,
601) []fantasy.MessagePart {
602 normalized := make([]fantasy.MessagePart, 0, len(parts))
603 for _, part := range parts {
604 toolCall, ok := safeAsToolCallPart(part)
605 if !ok {
606 normalized = append(normalized, part)
607 continue
608 }
609
610 toolCall.Input = normalizeToolCallInput(toolCall.Input)
611 normalized = append(normalized, toolCall)
612 }
613 return normalized
614}
615
616// normalizeToolCallInput guarantees tool call input is a JSON object string.
617// Anthropic drops assistant tool calls with malformed input, which can leave

Callers 1

ConvertMessagesWithFilesFunction · 0.85

Calls 2

safeAsToolCallPartFunction · 0.85
normalizeToolCallInputFunction · 0.85

Tested by

no test coverage detected