Skip to main content
Glama
javerthl

ServiceNow MCP Server

by javerthl

list_epics

Retrieve and filter epics from ServiceNow with options for priority, assignment group, timeframe, and custom queries to manage project initiatives.

Instructions

List epics from ServiceNow

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assignment_groupNoFilter by assignment group
limitNoMaximum number of records to return
offsetNoOffset to start from
priorityNoFilter by priority
queryNoAdditional query string
timeframeNoFilter by timeframe (upcoming, in-progress, completed)

Implementation Reference

  • The handler function that implements the logic for listing epics from ServiceNow. It validates parameters, builds a query based on filters, makes a GET request to the rm_epic table API, and returns the list of epics.
    def list_epics(
        auth_manager: AuthManager,
        server_config: ServerConfig,
        params: Dict[str, Any],
    ) -> Dict[str, Any]:
        """
        List epics from ServiceNow.
    
        Args:
            auth_manager: The authentication manager.
            server_config: The server configuration.
            params: The parameters for listing epics.
    
        Returns:
            A list of epics.
        """
        # Unwrap and validate parameters
        result = _unwrap_and_validate_params(
            params, 
            ListEpicsParams
        )
        
        if not result["success"]:
            return result
        
        validated_params = result["params"]
        
        # Build the query
        query_parts = []
        
        if validated_params.priority:
            query_parts.append(f"priority={validated_params.priority}")
        if validated_params.assignment_group:
            query_parts.append(f"assignment_group={validated_params.assignment_group}")
        
        # Handle timeframe filtering
        if validated_params.timeframe:
            now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
            if validated_params.timeframe == "upcoming":
                query_parts.append(f"start_date>{now}")
            elif validated_params.timeframe == "in-progress":
                query_parts.append(f"start_date<{now}^end_date>{now}")
            elif validated_params.timeframe == "completed":
                query_parts.append(f"end_date<{now}")
        
        # Add any additional query string
        if validated_params.query:
            query_parts.append(validated_params.query)
        
        # Combine query parts
        query = "^".join(query_parts) if query_parts else ""
        
        # Get the instance URL
        instance_url = _get_instance_url(auth_manager, server_config)
        if not instance_url:
            return {
                "success": False,
                "message": "Cannot find instance_url in either server_config or auth_manager",
            }
        
        # Get the headers
        headers = _get_headers(auth_manager, server_config)
        if not headers:
            return {
                "success": False,
                "message": "Cannot find get_headers method in either auth_manager or server_config",
            }
        
        # Make the API request
        url = f"{instance_url}/api/now/table/rm_epic"
        
        params = {
            "sysparm_limit": validated_params.limit,
            "sysparm_offset": validated_params.offset,
            "sysparm_query": query,
            "sysparm_display_value": "true",
        }
        
        try:
            response = requests.get(url, headers=headers, params=params)
            response.raise_for_status()
            
            result = response.json()
            
            # Handle the case where result["result"] is a list
            epics = result.get("result", [])
            count = len(epics)
            
            return {
                "success": True,
                "epics": epics,
                "count": count,
                "total": count,  # Use count as total if total is not provided
            }
        except requests.exceptions.RequestException as e:
            logger.error(f"Error listing epics: {e}")
            return {
                "success": False,
                "message": f"Error listing epics: {str(e)}",
            }
  • Pydantic model defining the input parameters for the list_epics tool, including pagination, filters, and custom query.
    class ListEpicsParams(BaseModel):
        """Parameters for listing epics."""
    
        limit: Optional[int] = Field(10, description="Maximum number of records to return")
        offset: Optional[int] = Field(0, description="Offset to start from")
        priority: Optional[str] = Field(None, description="Filter by priority")
        assignment_group: Optional[str] = Field(None, description="Filter by assignment group")
        timeframe: Optional[str] = Field(None, description="Filter by timeframe (upcoming, in-progress, completed)")
        query: Optional[str] = Field(None, description="Additional query string")
  • Registration of the list_epics tool in the central tool definitions dictionary, mapping name to implementation, schema, description, and serialization details.
    "list_epics": (
        list_epics_tool,
        ListEpicsParams,
        str,  # Expects JSON string
        "List epics from ServiceNow",
        "json",  # Tool returns list/dict
    ),
  • Import of the list_epics function in the tools package __init__.py for re-exporting.
    from servicenow_mcp.tools.epic_tools import (
        create_epic,
        update_epic,
        list_epics,
    )
  • Inclusion of list_epics in the __all__ list for public API exposure.
    "list_epics",
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure but provides none. It doesn't indicate whether this is a read-only operation, what permissions might be required, whether results are paginated, what format the output takes, or any rate limits. The simple statement 'List epics from ServiceNow' reveals nothing about the tool's behavior beyond the obvious action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just 4 words. It's front-loaded with the essential action and resource. There's zero wasted language or unnecessary elaboration. While it may be too brief for completeness, it earns full marks for conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (6 parameters, no output schema, no annotations), the description is inadequate. It doesn't explain what constitutes an 'epic' in ServiceNow, what fields are returned, how results are structured, or any behavioral characteristics. For a listing tool with multiple filtering parameters, more context is needed to help an agent use it effectively.

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 input schema has 100% description coverage, providing clear documentation for all 6 parameters. The description adds no parameter information beyond what's in the schema. According to scoring rules, when schema_description_coverage is high (>80%), the baseline is 3 even with no param info in the description, which applies here.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'List epics from ServiceNow' states the basic action (list) and resource (epics) but is vague about scope and filtering capabilities. It doesn't distinguish this tool from other list_* tools on the server or explain what 'epics' are in the ServiceNow context. The purpose is clear at a basic level but lacks specificity.

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. With many sibling tools including create_epic, update_epic, and other list_* tools, there's no indication of when list_epics is appropriate versus when other listing tools might be needed. No context about prerequisites or typical use cases is provided.

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/javerthl/servicenow-mcp'

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