Skip to content

fix(tools): support legacy strands module-based tool pattern#14

Merged
galuszkm merged 1 commit intomainfrom
fix/mg/module-based-tool-fallback-strands
Mar 27, 2026
Merged

fix(tools): support legacy strands module-based tool pattern#14
galuszkm merged 1 commit intomainfrom
fix/mg/module-based-tool-fallback-strands

Conversation

@galuszkm
Copy link
Copy Markdown
Member

Description

load_tools_from_module() now falls back to strands' load_tools_from_module() when no @tool-decorated functions are found. This adds support for legacy module-based tools that use the TOOL_SPEC + same-name function pattern (e.g. strands_tools.http_request).

Previously, strands_tools.http_request required the explicit colon syntax (strands_tools.http_request:http_request). Now the bare module path works, matching strands SDK behavior.

Modules with no @tool functions and no TOOL_SPEC now raise AttributeError instead of silently returning [].

Related Issues

N/A

Type of Change

  • Bug fix

YAML / API Impact

Backwards-compatible. Tool specs that previously required :function_name suffix for module-based tools now work without it. No schema changes. Modules with neither @tool nor TOOL_SPEC now raise instead of silently producing no tools — this surfaces config errors earlier.

Testing

How have you tested the change?

  • I ran uv run just check (lint + type check)
  • I ran uv run just test for overall testing
  • I added or updated tests that prove my fix is effective or my feature works
  • I verified existing examples in examples/ still work

Checklist

  • I have read the CONTRIBUTING document
  • I have updated the documentation accordingly
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

- Update tool loader to fall back to strands module pattern when no @tool-decorated functions found
- Import strands load_tools_from_module for TOOL_SPEC-based tool compatibility
- Add test coverage for TOOL_SPEC module pattern, private tools, and error cases
@galuszkm galuszkm merged commit 2633691 into main Mar 27, 2026
10 checks passed
@galuszkm galuszkm deleted the fix/mg/module-based-tool-fallback-strands branch March 27, 2026 14:29
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.

1 participant