Skip to main content
Glama
JLKmach

ServiceNow MCP Server

by JLKmach

create_story_dependency

Establish relationships between ServiceNow stories by defining dependencies, ensuring proper workflow sequencing in agile project management.

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

  • The main handler function implementing the logic for the 'create_story_dependency' tool. It validates input parameters using CreateStoryDependencyParams, constructs a POST request to the ServiceNow 'm2m_story_dependencies' table API, and returns the created dependency or error.
    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 BaseModel defining the input schema for the create_story_dependency tool, requiring 'dependent_story' and 'prerequisite_story' sys_ids.
    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 the get_tool_definitions() dictionary, associating the tool name 'create_story_dependency' with its aliased handler function, input schema (CreateStoryDependencyParams), return type, description, and serialization method.
    "create_story_dependency": (
        create_story_dependency_tool,
        CreateStoryDependencyParams,
        str,
        "Create a dependency between two stories in ServiceNow",
        "str",
    ),
  • Exposes the create_story_dependency function in the tools package __all__ list for easy import.
    "create_story_dependency",
  • Import alias for the handler function used 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?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool creates a dependency but doesn't describe what that entails—e.g., whether it's a blocking relationship, if it requires specific permissions, what happens on failure, or if it's reversible. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

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 with zero waste. It's front-loaded with the core action and resource, making it easy to parse quickly. Every word earns its place without redundancy or unnecessary elaboration.

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 complexity of creating a dependency (a mutation operation) with no annotations and no output schema, the description is incomplete. It lacks details on behavioral aspects like permissions, error handling, or what the dependency entails, which are crucial for an AI agent to use this tool correctly in ServiceNow context.

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 schema description coverage is 100%, with clear descriptions for both parameters ('dependent_story' and 'prerequisite_story') in the input schema. The description doesn't add any meaning beyond what the schema provides, such as explaining the relationship between the stories or format details. Baseline 3 is appropriate when the schema does the heavy lifting.

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 between two stories') and the resource ('in ServiceNow'), providing a specific verb and resource. It distinguishes from sibling tools like 'delete_story_dependency' and 'list_story_dependencies' by focusing on creation, but doesn't explicitly differentiate from other story-related tools like 'create_story' beyond the dependency aspect.

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?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites, such as needing existing stories or specific permissions, nor does it reference related tools like 'delete_story_dependency' or 'list_story_dependencies' for context. Usage is implied only by the tool name and action.

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

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