Skip to content

Conversation

@EricGustin
Copy link
Member

The Bug:

When an entrypoint file imports its parent package and calls add_tools_from_module() on that package, and the same entrypoint file also defines tools using @app.tool or @tool decorators, then the server fails to start with an AttributeError. This is because the tools would be discovered via AST parsing, but those tools weren't added to the module's namespace yet because the file is still executing.

For example, this would fail on startup:

#!/usr/bin/env python3
"""local_filesystem MCP server"""

import sys
from typing import Annotated

from arcade_mcp_server import MCPApp

import local_filesystem

app = MCPApp(name="eric_server", version="1.0.0", log_level="DEBUG")


app.add_tools_from_module(local_filesystem)


@app.tool
def eric(name: Annotated[str, "The name of the person to greet"]) -> str:
    """Greet a person by name."""
    return "return"


if __name__ == "__main__":
    transport = sys.argv[1] if len(sys.argv) > 1 else "stdio"

    app.run(transport="http", host="127.0.0.1", port=8074)

The fix:

Skip the entrypoint file. This means that any tool defined inside of the entrypoint file must be added via MCPApp.add_tool(...) or instead use the recommended @app.tool.

@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

❌ Patch coverage is 14.28571% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
libs/arcade-core/arcade_core/toolkit.py 14.28% 12 Missing ⚠️

📢 Thoughts on this report? Let us know!

@EricGustin
Copy link
Member Author

EricGustin commented Nov 3, 2025

Codecov Report

❌ Patch coverage is 14.28571% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
libs/arcade-core/arcade_core/toolkit.py 14.28% 12 Missing ⚠️
📢 Thoughts on this report? Let us know!

These changes are fully covered by the E2E integration test now which aren't included in the codecov report

@EricGustin EricGustin requested a review from a team November 3, 2025 19:00
@EricGustin EricGustin added the type: fix For small bug fixes or updates that will result in a patch version increment label Nov 3, 2025
@EricGustin EricGustin merged commit d89b3a5 into main Nov 3, 2025
42 of 43 checks passed
@EricGustin EricGustin deleted the ericgustin/skip-entrypoint branch November 3, 2025 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix For small bug fixes or updates that will result in a patch version increment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants