Skip to content

[BUG] #40

@aquastartw

Description

@aquastartw

Describe the bug

  File "/Users/jamesliao/dev/AI/nlp/nxtNLP/python/.venv/lib/python3.11/site-packages/fastapi_mcp/http_tools.py", line 133, in _create_http_tool_function
    exec(dynamic_function_body, namespace)
  File "<string>", line 1
    async def dynamic_http_tool_function(q: str, username: str = , maxResults: int = 20):
                                                               ^
SyntaxError: expected default value expression

To Reproduce
Define a router liks this:

@router.post("/post")
def post_post(
    q: Annotated[str, Query()],
    username: Annotated[str, Query()] = "",
    max_comments: Annotated[int, Query(alias="maxResults")] = 20,
):

System Info
macOS 15.3.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions