Skip to main content
Glama

testmo_list_case_attachments

Retrieve all attachments linked to a specific test case by providing the case ID. Supports pagination and optional expansion of related entities.

Instructions

List all attachments for a test case.

Args: case_id: The test case ID. page: Page number (default: 1). per_page: Results per page (default: 100). Valid: 25, 50, 100. expands: Related entities to include.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
case_idYes
pageNo
per_pageNo
expandsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the testmo_list_case_attachments tool. It is decorated with @mcp.tool() and makes a GET request to /cases/{case_id}/attachments with pagination and optional expands parameters.
    @mcp.tool()
    async def testmo_list_case_attachments(
        case_id: int,
        page: int = 1,
        per_page: int = 100,
        expands: list[str] | None = None,
    ) -> dict[str, Any]:
        """List all attachments for a test case.
    
        Args:
            case_id: The test case ID.
            page: Page number (default: 1).
            per_page: Results per page (default: 100). Valid: 25, 50, 100.
            expands: Related entities to include.
        """
        params: dict[str, Any] = {"page": page, "per_page": per_page}
        if expands:
            params["expands"] = ",".join(expands)
        return await _request("GET", f"/cases/{case_id}/attachments", params=params)
  • Input schema for the tool: case_id (int, required), page (int, default 1), per_page (int, default 100), expands (optional list of strings). Returns dict[str, Any].
    async def testmo_list_case_attachments(
        case_id: int,
        page: int = 1,
        per_page: int = 100,
        expands: list[str] | None = None,
  • The tool is registered via the @mcp.tool() decorator on the FastMCP instance 'mcp' imported from testmo.server. The import of testmo.tools.attachments in testmo-mcp.py triggers the registration.
    @mcp.tool()
    async def testmo_list_case_attachments(
  • Helper function _prepare_file that reads/compresses files before upload. Not directly used by testmo_list_case_attachments (which only reads), but a supporting utility in the same module.
    def _prepare_file(file_path: str) -> tuple[str, bytes, str]:
        """Read a file and compress it if it's a large image. Returns (filename, content, content_type)."""
        path = Path(file_path)
        if not path.exists():
            raise ValueError(f"File not found: {file_path}")
        file_content = path.read_bytes()
        suffix = path.suffix.lower()
        if suffix in IMAGE_EXTENSIONS and len(file_content) > MAX_IMAGE_SIZE:
            img = Image.open(io.BytesIO(file_content))
            img = img.convert("RGB")
            buf = io.BytesIO()
            quality = 85
            img.save(buf, format="JPEG", quality=quality, optimize=True)
            while buf.tell() > MAX_IMAGE_SIZE and quality > 20:
                quality -= 10
                buf = io.BytesIO()
                img.save(buf, format="JPEG", quality=quality, optimize=True)
            file_content = buf.getvalue()
            filename = path.stem + ".jpg"
            content_type = "image/jpeg"
        else:
            filename = path.name
            content_type = mimetypes.guess_type(path.name)[0] or "application/octet-stream"
        return filename, file_content, content_type
  • The _request helper function used by testmo_list_case_attachments to make the actual HTTP GET request to the Testmo API.
    async def _request(
        method: str,
        endpoint: str,
        data: dict[str, Any] | None = None,
        params: dict[str, Any] | None = None,
    ) -> dict[str, Any]:
        async with _get_client() as client:
            response = await client.request(
                method=method,
                url=endpoint,
                json=data,
                params=params,
            )
            if response.status_code == 204:
                return {"success": True}
            if response.status_code >= 400:
                try:
                    error_body = response.json()
                except Exception:
                    error_body = response.text
                raise RuntimeError(
                    f"Testmo API error {response.status_code}: "
                    f"{json.dumps(error_body) if isinstance(error_body, dict) else error_body}"
                )
            return response.json()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must cover behavioral traits. It repeats parameter defaults but does not disclose whether the operation is read-only, rate limits, authentication needs, or behavior on invalid inputs. The description adds minimal behavioral context beyond the schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise—one line for purpose followed by a compact bullet-like list for parameters. Every sentence adds value, and the structure is front-loaded with the main action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema and 4 parameters, the description covers the basics but omits details like pagination behavior (e.g., how to retrieve all pages) and edge cases. It is adequate but not fully comprehensive.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description effectively adds meaning: it explains each parameter's purpose (e.g., 'page: Page number (default: 1)'), provides valid values for per_page, and clarifies expands as 'Related entities to include.' This goes beyond the schema's type definitions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states 'List all attachments for a test case', which is a specific verb and resource. It clearly distinguishes from sibling tools like 'testmo_delete_case_attachments' and 'testmo_upload_case_attachment'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies use when needing to view attachments, but it does not explicitly state when to use this tool versus alternatives or provide any when-not scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/strelec00/testmo-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server