googleapis / googleapis/python-genai

Allow `allowed_tools` for MCP function calling

Open
#1,089 2 comments 0 reactions 1 assignee Claimed by @Venkaiahbabuneelam View on GitHub
priority: p3 type: feature request
Dominant language
Python
Stars
4k
Forks
1k
Avg merge
2d 11h
Merged PRs (30d)
40

Description

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!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.