Skip to content

Conversation

@ryoppippi
Copy link
Member

@ryoppippi ryoppippi commented Aug 14, 2025

Summary

This PR simplifies meta tool function names to match the Node SDK naming conventions, improving consistency between the Python and Node.js SDKs.

Breaking Changes

Function Names

  • create_meta_search_tools_filter_tool()create_meta_search_tools()
  • create_meta_search_tools_execute_tool()create_meta_execute_tool()

File Names

  • meta_search_tools.pymeta_tools.py
  • test_meta_search_tools.pytest_meta_tools.py
  • meta_search_tools_example.pymeta_tools_example.py

Method Names

  • Tools.meta_search_tools()Tools.meta_tools()

No Changes to Tool Names

The actual tool names remain the same for API compatibility:

  • meta_search_tools (search/discovery tool)
  • meta_execute_tool (execution tool)

Migration Guide

If you are using the meta tools directly:

# Before
from stackone_ai.meta_search_tools import create_meta_search_tools_filter_tool, create_meta_search_tools_execute_tool
meta_tools = all_tools.meta_search_tools()

# After  
from stackone_ai.meta_tools import create_meta_search_tools, create_meta_execute_tool
meta_tools = all_tools.meta_tools()

Additional Improvements

  • Standardized terminology in documentation and comments to use "meta tools" (the feature) vs individual tool names
  • Updated all examples and tests to reflect the new naming
  • All tests pass, linting and type checking successful

This change brings the Python SDK in line with the Node SDK changes from StackOneHQ/stackone-ai-node#86

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic analysis

2 issues found across 9 files • Review in cubic

React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.

else:
func = partial(self.execute, kwargs if kwargs else None)

return await asyncio.get_event_loop().run_in_executor(None, func)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asyncio.get_event_loop() is deprecated inside coroutines as of Python 3.11 and can raise a RuntimeError if no loop is set. Use asyncio.get_running_loop() (or asyncio.to_thread) to obtain the current loop safely.

Prompt for AI agents
Address the following comment on stackone_ai/models.py at line 277:

<comment>`asyncio.get_event_loop()` is deprecated inside coroutines as of Python 3.11 and can raise a `RuntimeError` if no loop is set. Use `asyncio.get_running_loop()` (or `asyncio.to_thread`) to obtain the current loop safely.</comment>

<file context>
@@ -214,6 +216,66 @@ def execute(self, arguments: str | JsonDict | None = None) -&gt; JsonDict:
                 ) from e
             raise StackOneError(f&quot;Request failed: {e}&quot;) from e
 
+    def call(self, *args: Any, **kwargs: Any) -&gt; JsonDict:
+        &quot;&quot;&quot;Call the tool with the given arguments
+
+        This method provides a more intuitive way to execute tools directly.
+
+        Args:
</file context>
Suggested change
return await asyncio.get_event_loop().run_in_executor(None, func)
return await asyncio.get_running_loop().run_in_executor(None, func)

if args:
if len(args) > 1:
raise ValueError("Only one positional argument is allowed")
return self.execute(args[0])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the single positional argument is not a str or dict, execute() will attempt to treat it as a mapping and fail later with an obscure AttributeError when calling .items(). Validate the argument type here and raise a clear ValueError instead to avoid confusing downstream errors.

Prompt for AI agents
Address the following comment on stackone_ai/models.py at line 245:

<comment>If the single positional argument is not a `str` or `dict`, `execute()` will attempt to treat it as a mapping and fail later with an obscure `AttributeError` when calling `.items()`. Validate the argument type here and raise a clear `ValueError` instead to avoid confusing downstream errors.</comment>

<file context>
@@ -214,6 +216,66 @@ def execute(self, arguments: str | JsonDict | None = None) -&gt; JsonDict:
                 ) from e
             raise StackOneError(f&quot;Request failed: {e}&quot;) from e
 
+    def call(self, *args: Any, **kwargs: Any) -&gt; JsonDict:
+        &quot;&quot;&quot;Call the tool with the given arguments
+
+        This method provides a more intuitive way to execute tools directly.
+
+        Args:
</file context>

@ryoppippi
Copy link
Member Author

oh wait i'll merge it

@ryoppippi ryoppippi marked this pull request as draft August 14, 2025 10:26
@ryoppippi ryoppippi marked this pull request as ready for review August 14, 2025 10:33
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic analysis

1 issue found across 5 files • Review in cubic

React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.

return [tool.to_langchain() for tool in self.tools]

def meta_tools(self) -> "Tools":
def meta_search_tools(self) -> "Tools":
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming the public API from meta_tools() to meta_search_tools() outright breaks existing user code that still calls the old method; no compatibility shim or deprecated alias is provided. This contradicts the PR description which promises “Maintains backward compatibility”.

Prompt for AI agents
Address the following comment on stackone_ai/models.py at line 483:

<comment>Renaming the public API from meta_tools() to meta_search_tools() outright breaks existing user code that still calls the old method; no compatibility shim or deprecated alias is provided. This contradicts the PR description which promises “Maintains backward compatibility”.</comment>

<file context>
@@ -480,7 +480,7 @@ def to_langchain(self) -&gt; Sequence[BaseTool]:
         &quot;&quot;&quot;
         return [tool.to_langchain() for tool in self.tools]
 
-    def meta_tools(self) -&gt; &quot;Tools&quot;:
+    def meta_search_tools(self) -&gt; &quot;Tools&quot;:
         &quot;&quot;&quot;Return meta tools for tool discovery and execution
 
</file context>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the aim was to change the tool name to

meta_search_tools
meta_execute_tool

this doesnt do that?

@ryoppippi ryoppippi changed the title refactor: rename meta_tools method to meta_search_tools refactor: rename meta_filter_relevant_tools to meta_search_tools Aug 14, 2025
@ryoppippi ryoppippi requested a review from mattzcarey August 14, 2025 16:38
@ryoppippi ryoppippi closed this Aug 18, 2025
@ryoppippi ryoppippi reopened this Aug 18, 2025
- Rename create_meta_search_tools_filter_tool() to create_meta_search_tools()

- Rename create_meta_search_tools_execute_tool() to create_meta_execute_tool()

- Update file names: meta_search_tools.py to meta_tools.py

- Update method name: meta_search_tools() to meta_tools()

- Standardize terminology: use "meta tools" in comments/docs

- Keep tool names as meta_search_tools and meta_execute_tool

This aligns the Python SDK with the Node SDK naming conventions while maintaining the same functionality.
@ryoppippi ryoppippi force-pushed the rename-meta-tool-to-meta-search-tools branch from 1978e5c to 411ef06 Compare August 18, 2025 11:27
@ryoppippi ryoppippi changed the title refactor: rename meta_filter_relevant_tools to meta_search_tools feat: simplify meta tool names to match Node SDK Aug 18, 2025
@ryoppippi
Copy link
Member Author

@mattzcarey i think it is ready

@mattzcarey mattzcarey merged commit 4572609 into main Aug 18, 2025
2 checks passed
@mattzcarey mattzcarey deleted the rename-meta-tool-to-meta-search-tools branch August 18, 2025 11:37
@ryoppippi ryoppippi mentioned this pull request Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants