-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Feature/support mcp function meta extentions #2764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
dd31b33
5f7a7a1
a9c92cb
863c3aa
19c4e79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -291,6 +291,9 @@ class FunctionTool: | |
| timeout_error_function: ToolErrorFunction | None = None | ||
| """Optional formatter for timeout errors when timeout_behavior is "error_as_result".""" | ||
|
|
||
| meta: dict[str, Any] | None = None | ||
| """Optional metadata for the tool.""" | ||
|
|
||
| defer_loading: bool = False | ||
|
Comment on lines
+294
to
297
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Adding Useful? React with 👍 / 👎. |
||
| """Whether the Responses API should hide this tool definition until tool search loads it.""" | ||
|
|
||
|
|
@@ -325,6 +328,9 @@ class FunctionTool: | |
|
|
||
| _mcp_title: str | None = field(default=None, kw_only=True, repr=False) | ||
| """Internal MCP display title used for ToolCallItem metadata.""" | ||
|
|
||
| _meta: dict[str, Any] | None = field(default=None, kw_only=True, repr=False) | ||
| """Internal metadata used for ToolCallItem metadata.""" | ||
|
|
||
| @property | ||
| def qualified_name(self) -> str: | ||
|
|
@@ -428,6 +434,7 @@ def _build_wrapped_function_tool( | |
| defer_loading: bool = False, | ||
| sync_invoker: bool = False, | ||
| mcp_title: str | None = None, | ||
| meta: dict[str, Any] | None = None, | ||
| ) -> FunctionTool: | ||
| """Create a FunctionTool with copied-tool-aware failure handling bound in one place.""" | ||
| on_invoke_tool = with_function_tool_failure_error_handler( | ||
|
|
@@ -453,6 +460,7 @@ def _build_wrapped_function_tool( | |
| timeout_error_function=timeout_error_function, | ||
| defer_loading=defer_loading, | ||
| _mcp_title=mcp_title, | ||
| _meta=meta, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
| ), | ||
| failure_error_function, | ||
| ) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
metakwarg from MCP tool builder callThis call passes
meta=tool.metainto_build_wrapped_function_tool, but that helper’s signature does not accept ametaparameter, so MCP tool conversion will raiseTypeErrorat runtime whento_function_toolis executed. In practice, this breaks MCP tool registration/execution for any code path that converts tools through this helper.Useful? React with 👍 / 👎.