list_projects
Retrieve and manage all projects in SD Elements with customizable options like pagination, included fields, and expanded details for efficient project tracking and integration.
Instructions
List all projects in SD Elements
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expand | No | Fields to expand (comma-separated) | |
| include | No | Additional fields to include (comma-separated) | |
| page_size | No | Number of results per page (optional) |
Implementation Reference
- The core handler function for the 'list_projects' tool. Decorated with @mcp.tool() which also serves as registration. Fetches projects via API client and returns JSON.@mcp.tool() async def list_projects(ctx: Context, page_size: Optional[int] = None, include: Optional[str] = None, expand: Optional[str] = None) -> str: """List all projects in SD Elements""" global api_client if api_client is None: api_client = init_api_client() params = build_params({"page_size": page_size, "include": include, "expand": expand}) result = api_client.list_projects(params) return json.dumps(result, indent=2)
- src/sde_mcp_server/tools/__init__.py:3-3 (registration)Import statement in tools/__init__.py that loads and registers the projects tools via their decorators.from .projects import *
- src/sde_mcp_server/server.py:296-296 (registration)Import in server.py that triggers loading of all tools, including list_projects.from . import tools # noqa: F401
- Helper function build_params used in list_projects to construct API parameters from tool inputs.def build_params(args: Dict[str, Any]) -> Dict[str, Any]: """Helper function for building params""" params = {} if "page_size" in args and args["page_size"] is not None: params["page_size"] = args["page_size"] if "include" in args and args["include"] is not None: params["include"] = args["include"] if "expand" in args and args["expand"] is not None: params["expand"] = args["expand"] return params