Skip to main content
Glama

list_business_units

Retrieve and display all business units from the SD Elements platform using paginated results for efficient data management and integration.

Instructions

List all business units

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
page_sizeNoNumber of results per page (optional)

Implementation Reference

  • Implementation of the list_business_units tool handler, which initializes the API client if needed, builds parameters using build_params, calls the API to list business units, and returns the result as formatted JSON.
    @mcp.tool() async def list_business_units(ctx: Context, page_size: Optional[int] = None, include: Optional[str] = None, expand: Optional[str] = None) -> str: """List all business units""" 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_business_units(params) return json.dumps(result, indent=2)
  • Import of business_units module in tools/__init__.py, which executes the @mcp.tool() decorator to register the list_business_units tool with the MCP server.
    from .business_units import *
  • Shared helper function build_params that constructs the API request parameters from the tool's input arguments, filtering out None values. Used by list_business_units and likely other tools.
    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

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/geoffwhittington/sde-mcp'

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