fix: v0.2.7 — remove -> str annotations and trim docstrings to reduce tools/list payload
FastMCP generates outputSchema for every tool with a return annotation, roughly doubling the tools/list payload size. Multi-line docstrings with Args/Returns sections add further bulk that Claude Desktop must parse. - Strip -> str from all 23 @mcp.tool() functions - Trim every tool docstring to a single descriptive line (≤100 chars) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -102,12 +102,8 @@ def register_images(mcp: FastMCP, config: AppConfig, client: DsmClient) -> None:
|
||||
"""Register all image management tools with the MCP server."""
|
||||
|
||||
@mcp.tool()
|
||||
async def list_images() -> str:
|
||||
"""List all local Docker images sorted by size (largest first).
|
||||
|
||||
Shows name:tag, size, creation date, and whether the image is
|
||||
currently used by at least one container.
|
||||
"""
|
||||
async def list_images():
|
||||
"""List local Docker images sorted by size, showing tag, date, and in-use status."""
|
||||
try:
|
||||
img_data = await client.request(
|
||||
"SYNO.Docker.Image",
|
||||
@@ -156,18 +152,8 @@ def register_images(mcp: FastMCP, config: AppConfig, client: DsmClient) -> None:
|
||||
return "\n".join(lines)
|
||||
|
||||
@mcp.tool()
|
||||
async def delete_image(image_id: str, confirmed: bool = False) -> str:
|
||||
"""Delete a local Docker image by name:tag or image ID hash.
|
||||
|
||||
Without confirmed=True, returns a preview of what would be deleted.
|
||||
Refuses deletion if the image is used by any container.
|
||||
|
||||
Args:
|
||||
image_id: Image reference as "name:tag" (e.g. "nginx:1.24")
|
||||
or a full/short image hash (e.g. "sha256:14300de7…").
|
||||
confirmed: Must be True to actually delete. Default False shows
|
||||
a preview only.
|
||||
"""
|
||||
async def delete_image(image_id: str, confirmed: bool = False):
|
||||
"""Delete a local image by name:tag or hash. Requires confirmed=True; refuses if in use."""
|
||||
# Parse name and tag using the last ":" as separator so that
|
||||
# registry-prefixed images (e.g. "ghcr.io/foo/bar:v1") are handled
|
||||
# correctly. rpartition returns ("", "", original) when ":" is absent.
|
||||
@@ -284,16 +270,8 @@ def register_images(mcp: FastMCP, config: AppConfig, client: DsmClient) -> None:
|
||||
return f"Deleted {display_name} — {size_str} freed."
|
||||
|
||||
@mcp.tool()
|
||||
async def check_image_updates(project_name: str | None = None) -> str:
|
||||
"""Check for available image updates for a project or all images.
|
||||
|
||||
Queries the local image list and reports which images have the
|
||||
'upgradable' flag set by the NAS registry check.
|
||||
|
||||
Args:
|
||||
project_name: Optional project name to filter images.
|
||||
If omitted, checks all locally available images.
|
||||
"""
|
||||
async def check_image_updates(project_name: str | None = None):
|
||||
"""Check which local images have updates available (upgradable flag from NAS registry)."""
|
||||
try:
|
||||
data = await client.request(
|
||||
"SYNO.Docker.Image",
|
||||
|
||||
Reference in New Issue
Block a user