list_projects
Retrieve a list of all available Penpot projects to facilitate programmatic access and interaction with design files via the Penpot MCP Server.
Instructions
Retrieve a list of all available Penpot projects.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- penpot_mcp/server/mcp_server.py:168-176 (handler)The MCP tool handler function for 'list_projects'. It calls the PenpotAPI's list_projects method and handles errors, returning the projects wrapped in a dict.@self.mcp.tool() def list_projects() -> dict: """Retrieve a list of all available Penpot projects.""" try: projects = self.api.list_projects() return {"projects": projects} except Exception as e: return self._handle_api_error(e) @self.mcp.tool()
- penpot_mcp/api/penpot_api.py:471-497 (helper)Supporting helper method in PenpotAPI class that performs the actual HTTP request to list projects from Penpot API.def list_projects(self) -> Dict[str, Any]: """ List all available projects for the authenticated user. Returns: Dictionary containing project information """ url = f"{self.base_url}/rpc/command/get-all-projects" payload = {} # No parameters required response = self._make_authenticated_request('post', url, json=payload, use_transit=False) if self.debug: content_type = response.headers.get('Content-Type', '') print(f"\nResponse content type: {content_type}") print(f"Response preview: {response.text[:100]}...") # Parse JSON data = response.json() if self.debug: print("\nData preview:") print(json.dumps(data, indent=2)[:200] + "...") return data
- penpot_mcp/server/mcp_server.py:168-176 (registration)The @self.mcp.tool() decorator registers this function as the MCP tool named 'list_projects'.@self.mcp.tool() def list_projects() -> dict: """Retrieve a list of all available Penpot projects.""" try: projects = self.api.list_projects() return {"projects": projects} except Exception as e: return self._handle_api_error(e) @self.mcp.tool()