Cannot use code execution and function calls in the same interaction

According to https://ai.google.dev/gemini-api/docs/interactions/tool-combination#limitations (and several other documentation pages), function calls and other tools should be able to be combined when using the interactions API. However, when I try this, whether with code_execution or some other tool like url_context, I get the error Request contains an invalid argument.

Full error (click to expand)
/home/user/world-agent-interaction/node_modules/@google/genai/src/interactions/core/error.ts:66
      return new BadRequestError(status, error, message, headers);
             ^

BadRequestError: 400 {"error":{"message":"Request contains an invalid argument.","code":"invalid_request"}}
at APIError.generate (/home/user/world-agent-interaction/node_modules/@googlegoogle/genai/src/interactions/core/error.ts:66:14)
at GeminiNextGenAPIClient.makeStatusError (/home/user/world-agent-interaction/node_mo@googleules/@google/genai/src/interactions/client.ts:378:28)
at GeminiNextGenAPIClient.makeRequest (/home/user/world-agent-interaction/n@googlede_modules/@google/genai/src/interactions/client.ts:610:24)
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
at async Agent.test (/home/user/world-agent-interaction/src/interaction.ts:213:9)
at async  (/home/user/world-agent-interaction/src/main.ts:5:1) {
status: 400,
headers: Headers {},
error: {
error: {
message: 'Request contains an invalid argument.',
code: 'invalid_request'
}
}
}

Minimal example (typescript/javascript SDK):

import { GoogleGenAI } from '@google/genai';

const ai = new GoogleGenAI({});

await ai.interactions.create({
    model: 'gemini-3.1-flash-lite',
    input: 'say "hello, world"',
    tools: [
        { type: 'code_execution' },
        {
            type: 'function',
            name: 'foo',
            description: 'returns 1',
            parameters: {
                type: 'number',
            },
        },
    ],
});

Just combining native tools (e.g. code execution with URL context) doesn’t trigger the error.

I’ve tried this with gemini 3.1 flash lite, and gemini 3 flash preview. I am using the latest version of the typescript sdk (v2.8.0).

Is there anything I need to do to make this work, or is this a bug?

Thank you for any help you can provide.

Your config tool definition is incorrect.

{ …,
parameters: { type: 'number',},
}

should be

parameters:{
”parameter_name”:{type:integer, description:…}, ...
}

Thanks for your response! My understanding was that the parameters.type property is the output type of the function; regardless of whether this understanding is correct or not, excluding the code_execution tool but still declaration that function declartion does not throw an error, so that is not the problem. The actual function signatures that I am using are more complicated and are of the form of the examples in https://ai.google.dev/gemini-api/docs/interactions/function-calling (note the use of parameters.type in addition to parameters[argument].type).

Sorry, there was an error in the above input.
The parameter is input, not output.
output does not need to be defined.
If no args are needed, it should be written like this.

await ai.interactions.create({
    model: 'gemini-3.1-flash-lite',
    input: 'say "hello, world"',
    tools: [
        { type: 'code_execution' },
        {
            type: 'function',
            name: 'foo',
            description: 'returns 1',
            parameters: {
                type: 'object',
                properties:{}
            },
        },
    ],
});

I’m certain that this code can execute correctly.

I see, thank you for clarifying. It seems then that the actual bug is that some malformed function declarations are (incorrectly) accepted when they are not paired with some other tool, but are (correctly) rejected when multiple tools are used. I have found the invalid function declaration in my code and it now seems to go. Thanks again.