FG
💻 Software🤖 AI & LLMsAnthropic

Feature request: tool_choice='none' - for sending tool results, but ensuring another tool call does not occur

Fresh3 days ago
Mar 14, 20260 views
Confidence Score47%
47%

Problem

Currently, when sending tool results, the tool definitions must be included in the result. However, sometimes when sending tool results, a user may want to restrict the model not to call another tool. But since tool choice may not be set to "none" and the tool definitions are still present, there is no way to restrict Claude from calling any additional tools when sending tool results. [code block]

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Implement tool_choice='none' for tool result submissions

Medium Risk

The current implementation requires tool definitions to be included in the results sent to the model. This leads to a situation where the model may attempt to call another tool, even when the user intends to restrict further tool calls. The absence of a 'none' option for tool_choice prevents users from explicitly indicating that no further tool invocation should occur.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Modify Tool Result Submission Logic

    Update the logic in the API that handles tool result submissions to accept a new parameter 'tool_choice' with a value of 'none'. This will indicate that no additional tools should be called.

    javascript
    function submitToolResults(results, tool_choice) {
      if (tool_choice === 'none') {
        // Logic to prevent further tool calls
        return results;
      }
      // Existing logic to handle tool calls
    }
  2. 2

    Update API Documentation

    Revise the API documentation to include the new 'tool_choice' parameter. Provide examples of how to use 'tool_choice' with the value 'none' to prevent further tool calls.

    markdown
    ### API Endpoint: /submitToolResults
    
    **Parameters:**
    - `results`: The results from the tool.
    - `tool_choice`: Optional. Set to 'none' to prevent further tool calls.
    
    **Example:**
    ```json
    {
      "results": {...},
      "tool_choice": "none"
    }
    ```
  3. 3

    Implement Unit Tests for New Logic

    Create unit tests to verify that when 'tool_choice' is set to 'none', no further tool calls are made. Ensure that the tests cover various scenarios including valid and invalid inputs.

    javascript
    describe('submitToolResults', () => {
      it('should not call additional tools when tool_choice is none', () => {
        const results = {...};
        const response = submitToolResults(results, 'none');
        expect(response).toEqual(results);
        // Add assertions to check that no further tool calls were made
      });
    });
  4. 4

    Deploy Changes to Staging Environment

    Deploy the changes to the staging environment for further testing. Ensure that all new features are functioning as expected without introducing regressions.

  5. 5

    Monitor and Validate in Production

    After deploying to production, monitor the system for any unexpected behavior related to tool calls. Validate that users can successfully submit tool results with 'tool_choice' set to 'none' without triggering additional tool invocations.

Validation

Confirm that when 'tool_choice' is set to 'none', the model does not attempt to call any additional tools. Review logs and user feedback to ensure the feature is functioning as intended.

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

claudeanthropicllmapi