Skip to content

[BUG] tavily-mcp@0.1.3 cannot pass the tool name validation in Strands #54

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

Closed
3 tasks done
xiehust opened this issue May 20, 2025 · 5 comments
Closed
3 tasks done
Assignees
Labels
bug Something isn't working

Comments

@xiehust
Copy link
Contributor

xiehust commented May 20, 2025

Checks

  • I have updated to the lastest minor and patch version of Strands
  • I have checked the documentation and this is not expected behavior
  • I have searched ./issues and there are no duplicates of my issue

Strands Version

0.1.2

Python Version

3.13.2

Operating System

ubuntu

Installation Method

pip

Steps to Reproduce

I am buiding a agent with MCP server from tavily search https://docs.tavily.com/documentation/mcp
however it raises exception :

tool_name=<tavily-search> | invalid tool name pattern

than I looked at the code,

tool_name_pattern = r"^[a-zA-Z][a-zA-Z0-9_]*$"

it seems that the validation regex did not include pattern as "tavily-search".

def validate_tool_use_name(tool: ToolUse) -> None:
    """Validate the name of a tool use.

    Args:
        tool: The tool use to validate.

    Raises:
        InvalidToolUseNameException: If the tool name is invalid.
    """
    # We need to fix some typing here, because we dont actually expect a ToolUse, but dict[str, Any]
    if "name" not in tool:
        message = "tool name missing"  # type: ignore[unreachable]
        logger.warning(message)
        raise InvalidToolUseNameException(message)

    tool_name = tool["name"]
    tool_name_pattern = r"^[a-zA-Z][a-zA-Z0-9_]*$"

Expected Behavior

should pass the validation, as tavily mcp is widely used in agents

Actual Behavior

failed to pass the name validation

Additional Context

No response

Possible Solution

tool_name_pattern = r"^[a-zA-Z][a-zA-Z0-9_-]*$" # Added hyphen to allowed characters

Related Issues

No response

@ybalbert001
Copy link

I reproduce this bug

@Unshure Unshure assigned zastrowm and unassigned pgrayy May 27, 2025
@zastrowm
Copy link
Member

Fixed by #55

@zastrowm
Copy link
Member

Created #139 to track direct method invocation of tools with hyphen in the name

@mrityunjayshukla
Copy link
Contributor

@zastrowm is there an ETA to merge the fix for this bug?

@zastrowm
Copy link
Member

@zastrowm is there an ETA to merge the fix for this bug?

#55 fixes this and was merged yesterday. It should be available the next time we release to pypi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants