Docs: local MCP require_approval callable form omitted from docs/mcp.md
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 87/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- documentation
Hướng nghiên cứu
Đọc phần “Approval policies for local MCP servers” trong docs/mcp.md và kiểm tra kiểu callable cùng docstring của constructor trong src/agents/mcp/server.py. Ghi lại dạng (run_context, agent, tool) -> bool | Awaitable[bool], lưu ý rằng tool là Tool của MCP SDK có annotations, cùng với hành vi được mô tả khi không có agent. Hoàn tất khi các dạng được hỗ trợ và hành vi của callable được làm rõ trong tài liệu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Please read this first
- Have you read the docs? Yes — MCP docs and Human-in-the-loop
- Have you searched for related issues? Yes. #5315 asks to expose MCP
ToolAnnotationson convertedFunctionToolfor hooks. This issue is separate: the callablerequire_approvalpolicy that already receives the original MCPTool(including annotations) is implemented but not documented indocs/mcp.md.
Describe the docs gap
docs/mcp.md → Approval policies for local MCP servers lists these supported forms for require_approval on MCPServerStdio / MCPServerSse / MCPServerStreamableHttp:
"always"/"never"True/False- per-tool map
- grouped
{always, never}object
It omits the callable form that the public type and constructor docstring already accept.
Exact doc path
docs/mcp.md— section starting at “Approval policies for local MCP servers” (Supported forms list)- Cross-link:
docs/human_in_the_loop.mdmentions local MCPrequire_approvalbut does not show the callable signature either - Examples under
examples/mcp/only demonstrate string/dict policies (get_all_mcp_tools_example,tool_filter_example)
Evidence in source (current main)
Type alias in src/agents/mcp/server.py:
LocalMCPApprovalCallable = Callable[
[RunContextWrapper[Any], "AgentBase", MCPTool],
MaybeAwaitable[bool],
]
Constructor docstring on MCPServer:
Accepts
"always"/"never", a dict of tool names to those values, a boolean, an object with always/never tool lists … or a sync/async callable that receives(run_context, agent, tool)and returns whether the tool call needs approval.
_normalize_needs_approval accepts callables, and _get_needs_approval_for_tool invokes policy(run_context, agent, tool) with the original MCP Tool — so callers can read tool.annotations (e.g. destructiveHint / readOnlyHint) without a parallel list_tools() cache.
Minimal illustration of the undocumented form
from mcp.types import Tool
from agents.mcp import MCPServerStreamableHttp
def approve_destructive(run_context, agent, tool: Tool) -> bool:
hints = tool.annotations
# Require HITL when the server marks the tool destructive (or omits read-only).
if hints and hints.read_only_hint:
return False
return bool(hints is None or hints.destructive_hint is not False)
server = MCPServerStreamableHttp(
name="crm",
params={"url": "http://localhost:8000/mcp"},
require_approval=approve_destructive, # valid API; missing from docs/mcp.md Supported forms
)
Expected docs change
- Add the callable form to the Supported forms list in
docs/mcp.md, with the signature(run_context, agent, tool) -> bool | Awaitable[bool]and a note thattoolis the MCP SDKTool(annotations available). - Optionally add a short example next to the existing dict example, and/or one line in
docs/human_in_the_loop.mdpointing at it. - Note the fail-closed behavior when a callable policy is used without an agent (documented in
_get_needs_approval_for_tool).
Happy to refine wording if maintainers prefer a different example shape. Because this repo accepts issues (not external PRs) for docs, filing here rather than opening a PR.
- Ngôn ngữ chính
- Python
- Star
- 29.9k
- Fork
- 4.8k
- Merge trung bình
- 22 giờ 17 phút
- Pull request đã merge (30 ngày)
- 208
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của openai/openai-agents-python
-
SandboxApplyPatchTool splits patch lines with str.splitlines(), so a form feed or in a line breaks Add/Update FileCó thể đã có người làm @abhishekacharya200 đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
openai/openai-agents-python#5349 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
openai/openai-agents-python#5348 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Support the OpenAI Decisions APIĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
openai/openai-agents-python#5353 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
RunState round trip drops alias-only fields: `"async": null` on a function call is serialized as `async_` and breaks `get_interruptions()` on restoreCó thể đã có người làm @iveteamorim đã nhận 1 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
openai/openai-agents-python#5352 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 55/100
openai/openai-agents-python#5351 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của openai/openai-agents-python
Issue tương tự
-
area: agents area: docs good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
openapi/gknowledge#23 ·
-
get() for StrEnumCó thể đã có người làm @FeJo5952 đã nhận hôm nay. Đang mởgood first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
collective/icalendar#1921 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Improvement Python Spans
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
getsentry/sentry-python#7994 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
alphagov/notifications-api#5004 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
equinor/radix-flux#3922 ·
Maintainer thường phản hồi trong vòng 1 ngày