docker_image_metadata
Retrieve Docker image metadata including popularity metrics, description, and update status from DockerHub to verify image details before deployment.
Instructions
Get detailed metadata for a specific Docker image from DockerHub.
USE THIS WHEN: You need comprehensive information about a Docker image (stats, description, tags).
RETURNS: Image metadata including popularity metrics and description.
Does NOT include full README documentation.
The response includes:
- Image name, namespace, description
- Star count (popularity)
- Pull count (total downloads)
- Last updated timestamp
- Official/community status
Args:
image: Docker image name (e.g., "nginx", "postgres", "username/custom-image")
Returns:
JSON with comprehensive image metadata
Example: docker_image_metadata("nginx") → Returns stars, pulls, description for nginx image
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image | Yes |
Implementation Reference
- src/RTFD/providers/dockerhub.py:348-374 (handler)The main execution handler for the 'docker_image_metadata' tool. It invokes the private _fetch_image_metadata helper and serializes the result into a CallToolResult.async def docker_image_metadata(image: str) -> CallToolResult: """ Get detailed metadata for a specific Docker image from DockerHub. USE THIS WHEN: You need comprehensive information about a Docker image (stats, description, tags). RETURNS: Image metadata including popularity metrics and description. Does NOT include full README documentation. The response includes: - Image name, namespace, description - Star count (popularity) - Pull count (total downloads) - Last updated timestamp - Official/community status Args: image: Docker image name (e.g., "nginx", "postgres", "username/custom-image") Returns: JSON with comprehensive image metadata Example: docker_image_metadata("nginx") → Returns stars, pulls, description for nginx image """ result = await self._fetch_image_metadata(image) return serialize_response_with_meta(result)
- src/RTFD/providers/dockerhub.py:436-439 (registration)Registration of the 'docker_image_metadata' tool handler in the dictionary returned by the get_tools() method, making it available as an MCP tool.tools = { "search_docker_images": search_docker_images, "docker_image_metadata": docker_image_metadata, }
- Private helper method that performs the HTTP request to DockerHub API to retrieve detailed metadata for the specified image, handling library images and errors.async def _fetch_image_metadata(self, image: str) -> dict[str, Any]: """Fetch detailed metadata for a Docker image. Args: image: Image name (can be 'namespace/name' or just 'name' for library) Returns: Dict with image metadata """ try: # Handle library images (e.g., 'nginx' -> 'library/nginx') if "/" not in image: repo_path = f"library/{image}" else: repo_path = image url = f"{self.DOCKERHUB_API_URL}/repositories/{repo_path}/" async with await self._http_client() as client: resp = await client.get(url) resp.raise_for_status() data = resp.json() return { "name": data.get("name"), "namespace": data.get("namespace"), "full_name": data.get("full_name", f"{data.get('namespace')}/{data.get('name')}"), "description": data.get("description", ""), "readme": data.get("readme", ""), # Full readme text if available "last_updated": data.get("last_updated"), "star_count": data.get("star_count", 0), "pull_count": data.get("pull_count", 0), "is_official": data.get("is_official", False), "is_private": data.get("is_private", False), "repository_type": data.get("repository_type"), "url": f"https://hub.docker.com/r/{repo_path}", } except httpx.HTTPStatusError as exc: if exc.response.status_code == 404: return { "image": image, "error": "Image not found on DockerHub", } return { "image": image, "error": f"DockerHub returned {exc.response.status_code}", } except httpx.HTTPError as exc: return { "image": image, "error": f"DockerHub request failed: {exc}", } except Exception as exc: return { "image": image, "error": f"Failed to fetch metadata: {exc!s}", }
- src/RTFD/providers/dockerhub.py:21-22 (registration)The tool name 'docker_image_metadata' is listed in the tool_names array returned by get_metadata(), exposing it in provider metadata.tool_names = ["search_docker_images", "docker_image_metadata"] if is_fetch_enabled():