Skip to main content
Glama

get_attachments

Retrieve metadata for files attached to Productive.io entities like tasks and comments, with filtering options to find specific documents, PDFs, or images.

Instructions

Get all attachments/files with optional filtering.

Attachments are files (PDFs, images, documents) that can be associated with various Productive entities like tasks, comments, expenses, etc.

Returns: Dictionary containing attachment metadata (name, type, size, relationships) Note: This provides metadata only, not actual file content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_numberNoPage number for pagination
page_sizeNoOptional number of attachments per page (max 200)
extra_filtersNoAdditional Productive query filters using API syntax

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that implements the get_attachments tool logic: constructs pagination and filter parameters, calls the Productive client API, filters the response using filter_response, logs progress, and handles API-specific and general errors.
    async def get_attachments(
        ctx: Context,
        page_number: int = None,
        page_size: int = config.items_per_page,
        extra_filters: dict = None
    ) -> ToolResult:
        """List attachments with optional filters and pagination (metadata only).
    
        Developer notes:
        - Enforces configurable default page[size] when not provided.
        - Sorting not supported by API - uses default order.
        """
        try:
            await ctx.info("Fetching attachments")
            params = {}
            if page_number is not None:
                params["page[number]"] = page_number
            params["page[size]"] = page_size
            if extra_filters:
                params.update(extra_filters)
    
            result = await client.get_attachments(params=params if params else None)
            await ctx.info("Successfully retrieved attachments")
            
            filtered = filter_response(result)
            
            return filtered
            
        except ProductiveAPIError as e:
            await _handle_productive_api_error(ctx, e, "attachments")
        except Exception as e:
            await ctx.error(f"Unexpected error fetching attachments: {str(e)}")
            raise e
  • server.py:565-588 (registration)
    Registers the 'get_attachments' tool in the MCP server using the @mcp.tool decorator. Includes detailed input schema definitions via Annotated parameters with Field descriptions and a comprehensive docstring describing inputs and outputs.
    @mcp.tool
    async def get_attachments(
        ctx: Context,
        page_number: Annotated[int, Field(description="Page number for pagination")] = None,
        page_size: Annotated[
            int, Field(description="Optional number of attachments per page (max 200)")
        ] = None,
        extra_filters: Annotated[
            dict, Field(description="Additional Productive query filters using API syntax")
        ] = None,
    ) -> Dict[str, Any]:
        """Get all attachments/files with optional filtering.
    
        Attachments are files (PDFs, images, documents) that can be associated with
        various Productive entities like tasks, comments, expenses, etc.
    
        Returns:
            Dictionary containing attachment metadata (name, type, size, relationships)
            Note: This provides metadata only, not actual file content
        """
        return await tools.get_attachments(
            ctx, page_number=page_number, page_size=page_size, extra_filters=extra_filters
        )
  • Helper method in ProductiveClient class that performs the actual HTTP GET request to the '/attachments' API endpoint with optional query parameters.
    async def get_attachments(self, params: Optional[dict] = None) -> Dict[str, Any]:
        """Get all attachments with optional filtering"""
        return await self._request("GET", "/attachments", params=params)
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds useful context: it specifies that returns are metadata only (not file content), mentions pagination and filtering capabilities, and implies a read-only operation. However, it lacks details on permissions, rate limits, error handling, or whether it's a safe operation, leaving gaps for a mutation-heavy context.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded: the first sentence states the core purpose, followed by clarifying details. Sentences are efficient, with no wasted words. However, the structure could be slightly improved by integrating the 'Returns' section more seamlessly, as it feels appended rather than integrated.

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

Completeness4/5

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

Given the context: no annotations, 3 parameters with full schema coverage, and an output schema exists (implied by 'Returns'), the description is reasonably complete. It covers the tool's purpose, what attachments are, and clarifies metadata vs. content. However, it lacks usage guidelines and some behavioral details (e.g., auth needs), which slightly reduces completeness for a tool in a potentially complex API environment.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all parameters (page_number, page_size, extra_filters). The description adds marginal value by implying filtering capabilities ('with optional filtering') and mentioning 'API syntax' for extra_filters, but doesn't provide syntax examples or clarify relationships beyond what the schema offers. This meets the baseline for high schema coverage.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Get all attachments/files with optional filtering' and specifies that attachments are files associated with Productive entities. It distinguishes itself from sibling tools by focusing on attachments rather than comments, tasks, people, etc. However, it doesn't explicitly differentiate from 'quick_search' which might also retrieve attachments, keeping it from a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It mentions that attachments are associated with various entities, but doesn't specify if this tool should be used over sibling tools like 'get_tasks' (which might include attachments) or 'quick_search' for finding attachments. There's no mention of prerequisites, exclusions, or specific contexts for usage.

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/druellan/Productive-GET-MCP'

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