Skip to main content
Glama

fetch_employees

Retrieve employee data from Paylocity for a specified company. Use this tool to access employee records, manage workforce information, and integrate with HR systems.

Instructions

Fetch all employees for a company.

Args: company_id: Optional company ID (string or integer). If not provided, uses the first company ID from configuration.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
company_idNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary handler for the 'fetch_employees' tool. Registered with @mcp.tool() decorator. Handles optional company_id parameter, selects default from config if omitted, applies retry via with_retry helper, and calls PaylocityClient.get_all_employees for the actual data fetch.
    def fetch_employees(company_id: Optional[Union[str, int]] = None) -> Dict[str, Any]:
        """
        Fetch all employees for a company.
        
        Args:
            company_id: Optional company ID (string or integer). If not provided, uses the first company ID from configuration.
        """
        company_id_str = str(company_id) if company_id is not None else company_ids[0]
        return with_retry(client.get_all_employees, company_id_str)
  • Helper function implementing retry logic with exponential backoff, used by the fetch_employees tool (and others) to handle transient API failures.
    def with_retry(func, *args, **kwargs):
        max_retries = 3
        retry_delay = 1  # seconds
        
        for attempt in range(max_retries):
            try:
                return func(*args, **kwargs)
            except Exception as e:
                if attempt < max_retries - 1:
                    logger.warning("Attempt %d failed: %s. Retrying in %d seconds...", attempt+1, str(e), retry_delay)
                    time.sleep(retry_delay)
                    retry_delay *= 2  # Exponential backoff
                else:
                    logger.error("Failed after %d attempts: %s", max_retries, str(e))
                    raise
  • Supporting method in PaylocityClient class that performs the actual HTTP API call to Paylocity's /employees endpoint, with pagination parameters and automatic token handling via _make_request.
    def get_all_employees(self, company_id) -> Dict[str, Any]:
        """Get all employees with automatic token management"""
        endpoint = "/api/v2/companies/{}/employees".format(company_id)
        
        params = {
            "pagesize": 100,
            "pagenumber": 0,
            "includetotalcount": True
        }
        
        try:
            return self._make_request("GET", endpoint, params=params).json()
        except Exception as e:
            logger.error("Failed to get employees for company %s: %s", company_id, str(e))
            raise
Behavior2/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 mentions the default behavior for company_id but lacks critical details such as whether this is a read-only operation, potential rate limits, authentication requirements, pagination, or what happens on errors. For a tool fetching all employees, this leaves significant gaps in understanding its behavior.

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 front-loaded with the core purpose in the first sentence, followed by parameter details in a structured 'Args' section. It avoids redundancy and is appropriately sized for a simple tool, though it could be slightly more concise by integrating the parameter explanation more seamlessly.

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?

Given the tool's low complexity (1 optional parameter) and the presence of an output schema (which handles return values), the description is minimally adequate. However, it lacks behavioral context (e.g., safety, performance) and sibling differentiation, making it incomplete for optimal agent use despite the structured support.

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?

The description adds meaningful context for the single parameter (company_id), explaining its optional nature and default behavior, which compensates for the 0% schema description coverage. However, it doesn't elaborate on format constraints (e.g., valid ID ranges) or implications of using null, keeping it at a baseline level.

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 with a specific verb ('fetch') and resource ('all employees for a company'), making it immediately understandable. However, it doesn't explicitly distinguish this tool from its siblings (e.g., fetch_employee_details, fetch_employee_earnings), which would require clarification on scope differences.

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 like fetch_employee_details or fetch_employee_earnings. It mentions a default behavior (using first company ID if none provided) but doesn't specify prerequisites, exclusions, or comparative contexts with sibling tools.

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/mz462/mcpPaylocity'

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