fix: remove -> str return annotations from all mcp.tool() functions
FastMCP generates an outputSchema from the return type annotation, which inflates the tools/list payload and triggers truncation in Claude Desktop. Dropping the annotations suppresses outputSchema generation entirely. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -105,7 +105,7 @@ def register_filestation(
|
||||
delay = min(delay * 2, 2.0)
|
||||
|
||||
@mcp.tool()
|
||||
async def list_shares() -> str:
|
||||
async def list_shares():
|
||||
"""List all shared folders visible to the authenticated user.
|
||||
|
||||
Returns a formatted table with share name, path, and volume status.
|
||||
@@ -163,7 +163,7 @@ def register_filestation(
|
||||
limit: int = 100,
|
||||
sort_by: str = "name",
|
||||
sort_direction: str = "asc",
|
||||
) -> str:
|
||||
):
|
||||
"""List the contents of a directory on the NAS.
|
||||
|
||||
Use share paths as returned by list_shares (e.g. "/dev", "/data"),
|
||||
@@ -265,7 +265,7 @@ def register_filestation(
|
||||
pattern: str,
|
||||
recursive: bool = True,
|
||||
max_results: int = 200,
|
||||
) -> str:
|
||||
):
|
||||
"""Search for files matching a glob pattern within a directory.
|
||||
|
||||
Starts an async DSM search task, polls until complete, then cleans up.
|
||||
@@ -399,7 +399,7 @@ def register_filestation(
|
||||
return "\n".join(lines)
|
||||
|
||||
@mcp.tool()
|
||||
async def download(path: str) -> str:
|
||||
async def download(path: str):
|
||||
"""Download a single file from the NAS and return its content as base64.
|
||||
|
||||
Files larger than 10 MB are rejected — use SFTP or another method instead.
|
||||
@@ -438,7 +438,7 @@ def register_filestation(
|
||||
)
|
||||
|
||||
@mcp.tool()
|
||||
async def get_info(path: str) -> str:
|
||||
async def get_info(path: str):
|
||||
"""Get detailed metadata for one or more files or folders on the NAS.
|
||||
|
||||
Accepts a single path or a comma-separated list of paths.
|
||||
@@ -539,7 +539,7 @@ def register_filestation(
|
||||
return "\n".join(lines)
|
||||
|
||||
@mcp.tool()
|
||||
async def check_exist(path: str) -> str:
|
||||
async def check_exist(path: str):
|
||||
"""Check whether one or more files or folders exist on the NAS.
|
||||
|
||||
Accepts a single path or a comma-separated list of paths.
|
||||
@@ -602,7 +602,7 @@ def register_filestation(
|
||||
path: str,
|
||||
name: str,
|
||||
create_parents: bool = False,
|
||||
) -> str:
|
||||
):
|
||||
"""Create a new folder on the NAS.
|
||||
|
||||
Args:
|
||||
@@ -634,7 +634,7 @@ def register_filestation(
|
||||
return f"Created: {created_path}"
|
||||
|
||||
@mcp.tool()
|
||||
async def rename(path: str, new_name: str) -> str:
|
||||
async def rename(path: str, new_name: str):
|
||||
"""Rename a file or folder on the NAS.
|
||||
|
||||
Args:
|
||||
@@ -665,7 +665,7 @@ def register_filestation(
|
||||
return f"Renamed to: {new_path}"
|
||||
|
||||
@mcp.tool()
|
||||
async def copy(src: str, dst: str, overwrite: bool = False) -> str:
|
||||
async def copy(src: str, dst: str, overwrite: bool = False):
|
||||
"""Copy a file or folder to a new location on the NAS.
|
||||
|
||||
WARNING: Set overwrite=True only when you intentionally want to replace
|
||||
@@ -710,7 +710,7 @@ def register_filestation(
|
||||
return f"Copied to: {dest_folder}/{filename}"
|
||||
|
||||
@mcp.tool()
|
||||
async def move(src: str, dst: str, overwrite: bool = False) -> str:
|
||||
async def move(src: str, dst: str, overwrite: bool = False):
|
||||
"""Move a file or folder to a new location on the NAS.
|
||||
|
||||
WARNING: Set overwrite=True only when you intentionally want to replace
|
||||
@@ -755,7 +755,7 @@ def register_filestation(
|
||||
return f"Moved to: {dest_folder}/{filename}"
|
||||
|
||||
@mcp.tool()
|
||||
async def delete(path: str, confirmed: bool = False) -> str:
|
||||
async def delete(path: str, confirmed: bool = False):
|
||||
"""Delete a file or folder on the NAS.
|
||||
|
||||
WARNING: This operation is irreversible. Without confirmed=True,
|
||||
@@ -809,7 +809,7 @@ def register_filestation(
|
||||
mode: str = "add",
|
||||
format: str = "zip",
|
||||
password: str = "",
|
||||
) -> str:
|
||||
):
|
||||
"""Compress files or folders into an archive on the NAS.
|
||||
|
||||
Creates a new archive asynchronously. Progress is polled until the operation
|
||||
@@ -879,7 +879,7 @@ def register_filestation(
|
||||
keep_dir: bool = True,
|
||||
create_subfolder: bool = False,
|
||||
password: str = "",
|
||||
) -> str:
|
||||
):
|
||||
"""Extract an archive file to a destination folder on the NAS.
|
||||
|
||||
Supports ZIP and 7z archives. Runs asynchronously; progress is polled
|
||||
@@ -939,7 +939,7 @@ def register_filestation(
|
||||
content_base64: str,
|
||||
overwrite: bool = False,
|
||||
create_parents: bool = True,
|
||||
) -> str:
|
||||
):
|
||||
"""Upload a file to a directory on the NAS from base64-encoded content.
|
||||
|
||||
WARNING: Set overwrite=True only when you intentionally want to replace
|
||||
|
||||
Reference in New Issue
Block a user