cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Generative AI
Explore discussions on generative artificial intelligence techniques and applications within the Databricks Community. Share ideas, challenges, and breakthroughs in this cutting-edge field.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Claude Code-Execution Call Format

jmartin1
New Contributor II

Is it possible to use the code execution tool with instances of Claude hosted through Databricks? If I try to format the payload like in Anthropic's documentation, I get an error that the function isn't defined properly: 

    tools=[{
        "type": "code_execution_20250825",
        "name": "code_execution"
    }]

Status code: 400
Response: {"error_code":"INVALID_PARAMETER_VALUE","message":"INVALID_PARAMETER_VALUE: Missing 'function' in the tool specification."}

And if I do define code-execution in the payload according to OpenAI's schema, I get a response with the generated code, but the model doesn't actually run it and return the results in the same output. 

1 ACCEPTED SOLUTION

Accepted Solutions

Louis_Frolio
Databricks Employee
Databricks Employee

Greeting @jmartin1 , 

The Anthropic โ€œcode executionโ€ tool isnโ€™t supported through Databricksโ€™ Foundation Model APIs. Databricks exposes an OpenAI-compatible tools interface, and the only supported tool type today is a function defined with a JSON schema. Thatโ€™s why youโ€™re seeing the error about a missing function field in your payload. The Databricks REST interface also differs from Anthropicโ€™s API, which means Anthropicโ€™s tool specifications canโ€™t be used directly.

Why youโ€™re seeing that error

Your payload is using Anthropicโ€™s tool format (for example, type: โ€œcode_execution_20250825โ€), but Databricks expects tools to be defined using the structure {โ€œtypeโ€: โ€œfunctionโ€, โ€œfunctionโ€: { โ€ฆ }}. When the server processes your tools array and doesnโ€™t find a function object, it returns the error: โ€œMissing โ€˜functionโ€™ in the tool specification.โ€

Cheers, Lou

View solution in original post

1 REPLY 1

Louis_Frolio
Databricks Employee
Databricks Employee

Greeting @jmartin1 , 

The Anthropic โ€œcode executionโ€ tool isnโ€™t supported through Databricksโ€™ Foundation Model APIs. Databricks exposes an OpenAI-compatible tools interface, and the only supported tool type today is a function defined with a JSON schema. Thatโ€™s why youโ€™re seeing the error about a missing function field in your payload. The Databricks REST interface also differs from Anthropicโ€™s API, which means Anthropicโ€™s tool specifications canโ€™t be used directly.

Why youโ€™re seeing that error

Your payload is using Anthropicโ€™s tool format (for example, type: โ€œcode_execution_20250825โ€), but Databricks expects tools to be defined using the structure {โ€œtypeโ€: โ€œfunctionโ€, โ€œfunctionโ€: { โ€ฆ }}. When the server processes your tools array and doesnโ€™t find a function object, it returns the error: โ€œMissing โ€˜functionโ€™ in the tool specification.โ€

Cheers, Lou