Skip to main content
Glama
javerthl

ServiceNow MCP Server

by javerthl

delete_story_dependency

Remove a story dependency in ServiceNow by providing the dependency sys_id to eliminate relationships between development tasks.

Instructions

Delete a story dependency in ServiceNow

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dependency_idYesSys_id of the dependency is required

Implementation Reference

  • The primary handler function that executes the delete_story_dependency tool. Validates input params, constructs the ServiceNow API DELETE endpoint for m2m_story_dependencies table using the dependency_id, and handles the HTTP request/response.
    def delete_story_dependency(
        auth_manager: AuthManager,
        server_config: ServerConfig,
        params: Dict[str, Any],
    ) -> Dict[str, Any]:
        """
        Delete a story dependency in ServiceNow.
    
        Args:
            auth_manager: The authentication manager.
            server_config: The server configuration.
            params: The parameters for deleting a story dependency.
    
        Returns:
            The deleted story dependency.
        """
        # Unwrap and validate parameters    
        result = _unwrap_and_validate_params(
            params, 
            DeleteStoryDependencyParams,
            required_fields=["dependency_id"]
        )
        
        if not result["success"]:
            return result
        
        validated_params = result["params"]
        
        # 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/m2m_story_dependencies/{validated_params.dependency_id}"
        
        try:
            response = requests.delete(url, headers=headers)
            response.raise_for_status()
            
            return {
                "success": True,
                "message": "Story dependency deleted successfully",
            }
        except requests.exceptions.RequestException as e:
            logger.error(f"Error deleting story dependency: {e}")
            return {
                "success": False,
                "message": f"Error deleting story dependency: {str(e)}",
            }
  • Pydantic BaseModel schema defining the input parameters for the delete_story_dependency tool, specifically requiring the sys_id of the dependency to delete.
    class DeleteStoryDependencyParams(BaseModel):
        """Parameters for deleting a story dependency."""
    
        dependency_id: str = Field(..., description="Sys_id of the dependency is required")
  • Registration of the 'delete_story_dependency' tool in the central tool_definitions dictionary used by the MCP server. Maps the tool name to its handler function (aliased), params schema, return type, description, and serialization method.
    "delete_story_dependency": (
        delete_story_dependency_tool,
        DeleteStoryDependencyParams,
        str,
        "Delete a story dependency in ServiceNow",
        "str",
    ),

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