Skip to main content
Glama
javerthl

ServiceNow MCP Server

by javerthl

create_story_dependency

Establish dependencies between ServiceNow stories to manage workflow relationships and ensure proper task sequencing.

Instructions

Create a dependency between two stories in ServiceNow

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dependent_storyYesSys_id of the dependent story is required
prerequisite_storyYesSys_id that this story depends on is required

Implementation Reference

  • Main handler function implementing the tool logic: validates params, makes POST request to ServiceNow m2m_story_dependencies table.
    def create_story_dependency(
        auth_manager: AuthManager,
        server_config: ServerConfig,
        params: Dict[str, Any],
    ) -> Dict[str, Any]:
        """
        Create a dependency between two stories in ServiceNow.
    
        Args:
            auth_manager: The authentication manager.
            server_config: The server configuration.
            params: The parameters for creating a story dependency.
    
        Returns:
            The created story dependency.
        """
        # Unwrap and validate parameters    
        result = _unwrap_and_validate_params(
            params, 
            CreateStoryDependencyParams,
            required_fields=["dependent_story", "prerequisite_story"]
        )
        
        if not result["success"]:
            return result
        
        validated_params = result["params"]
        
        # Prepare the request data
        data = {
            "dependent_story": validated_params.dependent_story,
            "prerequisite_story": validated_params.prerequisite_story,
        }
        
        # 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",
            }
        
        # Add Content-Type header
        headers["Content-Type"] = "application/json"
        
        # Make the API request
        url = f"{instance_url}/api/now/table/m2m_story_dependencies"
        
        try:
            response = requests.post(url, json=data, headers=headers)
            response.raise_for_status()
            
            result = response.json()    
            return {
                "success": True,
                "message": "Story dependency created successfully",
                "story_dependency": result["result"],
            }
        except requests.exceptions.RequestException as e:
            logger.error(f"Error creating story dependency: {e}")
            return {
                "success": False,
                "message": f"Error creating story dependency: {str(e)}",
            }
  • Pydantic schema defining input parameters for the tool.
    class CreateStoryDependencyParams(BaseModel):
        """Parameters for creating a story dependency."""
    
        dependent_story: str = Field(..., description="Sys_id of the dependent story is required")
        prerequisite_story: str = Field(..., description="Sys_id that this story depends on is required")
  • Tool registration in get_tool_definitions() dictionary: maps tool name to handler function, schema, description, etc.
    "create_story_dependency": (
        create_story_dependency_tool,
        CreateStoryDependencyParams,
        str,
        "Create a dependency between two stories in ServiceNow",
        "str",
    ),
  • Import of the handler function into tools package __init__ for exposure.
    from servicenow_mcp.tools.story_tools import (
        create_story,
        update_story,
        list_stories,
        list_story_dependencies,
        create_story_dependency,
  • Import alias of the handler function for use in tool registration.
    create_story_dependency as create_story_dependency_tool,
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. While 'Create' implies a write/mutation operation, the description doesn't address important behavioral aspects: what permissions are required, whether this operation is reversible, what happens if the dependency already exists, what the response looks like, or any rate limits. For a mutation tool with zero annotation coverage, this is insufficient.

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 a single, efficient sentence that states the core purpose without any unnecessary words. It's appropriately sized for a simple tool and gets straight to the point with zero waste or redundancy.

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?

For a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what happens after creation, what the response contains, error conditions, or how this operation fits into the broader ServiceNow story management workflow. The agent would need to guess about important behavioral aspects of this write operation.

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?

Schema description coverage is 100%, with both parameters clearly documented in the schema itself. The description adds no additional parameter information beyond what's already in the structured schema fields. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no parameter information in the description.

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 action ('Create a dependency') and resource ('between two stories in ServiceNow'), making the purpose immediately understandable. However, it doesn't distinguish this tool from its sibling 'delete_story_dependency' or explain how it differs from 'list_story_dependencies' - it only specifies what it does, not how it's unique among related tools.

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. There's no mention of prerequisites, when dependencies should be created, or how this relates to other story management tools like 'create_story', 'update_story', or 'delete_story_dependency'. The agent receives no contextual usage information beyond the basic purpose.

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