Skip to content

Allow allowed_tools for MCP function calling #1089

Description

@Khalidzo

Hey there, I'm using Gemini's SDK with an MCP server and noticed there's no way to restrict which tools the model can call. Currently, I'm doing:

GenerateContentConfig(
    system_instruction=system_message,
    temperature=0,
    tools=[mcp_client.session],
)

This gives access to all tools, but I'd like to allow only specific one, similar to allowed_tools in OpenAI's or Anthropic's SDKs. Would be great to have something like:

tools=[mcp_client.session.with_allowed_tools(["tool_a", "tool_b"])]

Thanks in advance!

Metadata

Metadata

Labels

priority: p3Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions