Skip to content

Feature Request: Add toolChoice Parameter for Tool Selection Control #23

@codewarnab

Description

@codewarnab

Summary

Add a toolChoice parameter to control how the model selects tools, similar to the Vercel AI SDK.

Proposed Type

type ToolChoice = 'auto' | 'none' | 'required' | { type: 'tool'; toolName: string };
Value Behavior
auto Model decides whether to call tools (default)
none Model must not call any tools
required Model must call at least one tool
{ type: 'tool', toolName } Model must call the specified tool

Usage Example

// Force tool usage
await session.send({
  prompt: "What's the weather in Seattle?",
  toolChoice: "required"
});

// Prevent tool usage
await session.send({
  prompt: "Explain how weather forecasting works",
  toolChoice: "none"
});

// Force specific tool
await session.send({
  prompt: "Get Seattle weather",
  toolChoice: { type: "tool", toolName: "get_weather" }
});

Reference

Contribution

I'm willing to implement the SDK changes (types, session.send, tests, docs) once backend support is confirmed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions