MCPcopy Index your code
hub / github.com/coder/coder / exclusiveToolPolicyResults

Function exclusiveToolPolicyResults

coderd/x/chatd/chatloop/chatloop.go:1500–1520  ·  view source on GitHub ↗
(
	toolCalls []fantasy.ToolCallContent,
	exclusiveToolNames map[string]bool,
	blockingToolName string,
)

Source from the content-addressed store, hash-verified

1498}
1499
1500func exclusiveToolPolicyResults(
1501 toolCalls []fantasy.ToolCallContent,
1502 exclusiveToolNames map[string]bool,
1503 blockingToolName string,
1504) []fantasy.ToolResultContent {
1505 results := make([]fantasy.ToolResultContent, len(toolCalls))
1506 for i, tc := range toolCalls {
1507 message := exclusiveToolSkippedErrorMessage(blockingToolName)
1508 if exclusiveToolNames[tc.ToolName] {
1509 message = exclusiveToolMustRunAloneErrorMessage(tc.ToolName)
1510 }
1511 results[i] = fantasy.ToolResultContent{
1512 ToolCallID: tc.ToolCallID,
1513 ToolName: tc.ToolName,
1514 Result: fantasy.ToolResultOutputContentError{
1515 Error: xerrors.New(message),
1516 },
1517 }
1518 }
1519 return results
1520}
1521
1522func exclusiveToolMustRunAloneErrorMessage(toolName string) string {
1523 return toolName + " must be called alone, without other tools in the same batch. Retry with only the " + toolName + " call."

Callers 1

applyExclusiveToolPolicyFunction · 0.85

Calls 3

NewMethod · 0.65

Tested by

no test coverage detected