Skip to main content
Glama

get_file

Retrieve and cache a specific Penpot design file using its unique ID to enable programmatic access for automated design workflows.

Instructions

Retrieve a Penpot file by its ID and cache it. Don't use this tool for code generation, use 'get_object_tree' instead.

        Args:
            file_id: The ID of the Penpot file
        

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_idYes

Implementation Reference

  • The primary handler function for the MCP 'get_file' tool. It fetches the complete file data from the Penpot API using the provided file_id, caches the result in memory, and returns the data or a formatted error response.
    def get_file(file_id: str) -> dict:
        """Retrieve a Penpot file by its ID and cache it. Don't use this tool for code generation, use 'get_object_tree' instead.
        
        Args:
            file_id: The ID of the Penpot file
        """
        try:
            file_data = self.api.get_file(file_id=file_id)
            self.file_cache.set(file_id, file_data)
            return file_data
        except Exception as e:
            return self._handle_api_error(e)
  • Internal helper function that checks the memory cache first before fetching and caching Penpot file data. Similar to get_file but cache-aware; used by other tools.
    def get_cached_file(file_id: str) -> dict:
        """Internal helper to retrieve a file, using cache if available.
        
        Args:
            file_id: The ID of the Penpot file
        """
        cached_data = self.file_cache.get(file_id)
        if cached_data is not None:
            return cached_data
        try:
            file_data = self.api.get_file(file_id=file_id)
            self.file_cache.set(file_id, file_data)
            return file_data
        except Exception as e:
            return self._handle_api_error(e)
  • Underlying PenpotAPI.get_file method invoked by the MCP tool handler. Sends authenticated POST request to Penpot's /rpc/command/get-file endpoint with the file_id, parses the JSON response, and optionally saves raw or normalized data.
    def get_file(self, file_id: str, save_data: bool = False,
                 save_raw_response: bool = False) -> Dict[str, Any]:
        """
        Get details for a specific file.
    
        Args:
            file_id: The ID of the file to retrieve
            features: List of features to include in the response
            project_id: Optional project ID if known
            save_data: Whether to save the data to a file
            save_raw_response: Whether to save the raw response
    
        Returns:
            Dictionary containing file information
        """
        url = f"{self.base_url}/rpc/command/get-file"
    
        payload = {
            "id": file_id,
        }
    
        response = self._make_authenticated_request('post', url, json=payload, use_transit=False)
    
        # Save raw response if requested
        if save_raw_response:
            raw_filename = f"{file_id}_raw_response.json"
            with open(raw_filename, 'w') as f:
                f.write(response.text)
            if self.debug:
                print(f"\nSaved raw response to {raw_filename}")
    
        # Parse JSON
        data = response.json()
    
        # Save normalized data if requested
        if save_data:
            filename = f"{file_id}.json"
            with open(filename, 'w') as f:
                json.dump(data, f, indent=2)
            if self.debug:
                print(f"\nSaved file data to {filename}")
    
        return data
  • Error handling utility used by the get_file tool (and others) to catch exceptions from the API call and return structured error responses, with special handling for CloudFlare protection.
    def _handle_api_error(self, e: Exception) -> dict:
        """Handle API errors and return user-friendly error messages."""
        if isinstance(e, CloudFlareError):
            return {
                "error": "CloudFlare Protection",
                "message": str(e),
                "error_type": "cloudflare_protection",
                "instructions": [
                    "Open your web browser and navigate to https://design.penpot.app",
                    "Log in to your Penpot account", 
                    "Complete any CloudFlare human verification challenges if prompted",
                    "Once verified, try your request again"
                ]
            }
        elif isinstance(e, PenpotAPIError):
            return {
                "error": "Penpot API Error",
                "message": str(e),
                "error_type": "api_error",
                "status_code": getattr(e, 'status_code', None)
            }
        else:
            return {"error": str(e)}
Behavior4/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 reveals two important behavioral traits: 1) the tool caches the retrieved file, and 2) it's specifically not intended for code generation purposes. However, it doesn't mention potential side effects, error conditions, or response format.

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 with two main sentences and a parameter section. The first sentence states the purpose, the second provides usage guidance, and the Args section documents the parameter. There's minimal waste, though the formatting could be cleaner.

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?

For a tool with no annotations, no output schema, and 0% schema description coverage, the description provides adequate basics (purpose, usage guidance, parameter meaning) but lacks details about return values, error handling, caching behavior specifics, or authentication requirements that would be helpful for an AI agent.

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?

With 0% schema description coverage, the description must compensate for the lack of parameter documentation. It provides the parameter name 'file_id' and clarifies it's 'The ID of the Penpot file', which adds meaningful context beyond the bare schema. However, it doesn't specify format requirements or validation rules.

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 clearly states the specific action ('Retrieve a Penpot file by its ID') and resource ('Penpot file'), and distinguishes it from sibling tools by explicitly naming 'get_object_tree' as an alternative for code generation. This provides excellent differentiation.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when NOT to use this tool ('Don't use this tool for code generation') and names a specific alternative ('use get_object_tree instead'). This gives clear context for tool selection among siblings.

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/montevive/penpot-mcp'

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