> ## Documentation Index > Fetch the complete documentation index at: https://openrouter.ai/docs/llms.txt > Use this file to discover all available pages before exploring further. # StopServerToolsWhenCondition A single condition that, when met, halts the server-tool agent loop. ## Supported Types ### StopServerToolsWhenFinishReasonIs ```go theme={null} stopServerToolsWhenCondition := components.CreateStopServerToolsWhenConditionFinishReasonIs(components.StopServerToolsWhenFinishReasonIs{/* values here */}) ``` ### StopServerToolsWhenHasToolCall ```go theme={null} stopServerToolsWhenCondition := components.CreateStopServerToolsWhenConditionHasToolCall(components.StopServerToolsWhenHasToolCall{/* values here */}) ``` ### StopServerToolsWhenMaxCost ```go theme={null} stopServerToolsWhenCondition := components.CreateStopServerToolsWhenConditionMaxCost(components.StopServerToolsWhenMaxCost{/* values here */}) ``` ### StopServerToolsWhenMaxTokensUsed ```go theme={null} stopServerToolsWhenCondition := components.CreateStopServerToolsWhenConditionMaxTokensUsed(components.StopServerToolsWhenMaxTokensUsed{/* values here */}) ``` ### StopServerToolsWhenStepCountIs ```go theme={null} stopServerToolsWhenCondition := components.CreateStopServerToolsWhenConditionStepCountIs(components.StopServerToolsWhenStepCountIs{/* values here */}) ``` ## Union Discrimination Use the `Type` field to determine which variant is active, then access the corresponding field: ```go theme={null} switch stopServerToolsWhenCondition.Type { case components.StopServerToolsWhenConditionTypeFinishReasonIs: // stopServerToolsWhenCondition.StopServerToolsWhenFinishReasonIs is populated case components.StopServerToolsWhenConditionTypeHasToolCall: // stopServerToolsWhenCondition.StopServerToolsWhenHasToolCall is populated case components.StopServerToolsWhenConditionTypeMaxCost: // stopServerToolsWhenCondition.StopServerToolsWhenMaxCost is populated case components.StopServerToolsWhenConditionTypeMaxTokensUsed: // stopServerToolsWhenCondition.StopServerToolsWhenMaxTokensUsed is populated case components.StopServerToolsWhenConditionTypeStepCountIs: // stopServerToolsWhenCondition.StopServerToolsWhenStepCountIs is populated } ```