Skip to main content
Glama
devrev

DevRev MCP Server

Official
by devrev

create_part

Create a new enhancement in DevRev by specifying type, name, assigned users, parent parts, and description.

Instructions

Create a new part (enhancement) in DevRev

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYes
nameYes
owned_byYesThe DevRev IDs of the users assigned to the part
parent_partYesThe DevRev IDs of the parent parts
descriptionNoThe description of the part

Implementation Reference

  • Handler function for executing the 'create_part' tool. Validates input arguments, builds the payload, calls the DevRev API 'parts.create' endpoint, and returns success or error message.
    elif name == "create_part":
        if not arguments:
            raise ValueError("Missing arguments")
    
        payload = {}
    
        type = arguments.get("type")
        if not type:
            raise ValueError("Missing type parameter")
        payload["type"] = type
    
        part_name = arguments.get("name")
        if not part_name:
            raise ValueError("Missing name parameter")
        payload["name"] = part_name
    
        owned_by = arguments.get("owned_by")
        if not owned_by:
            raise ValueError("Missing owned_by parameter")
        payload["owned_by"] = owned_by
    
        parent_part = arguments.get("parent_part")
        if not parent_part:
            raise ValueError("Missing parent_part parameter")
        payload["parent_part"] = parent_part
    
        description = arguments.get("description")
        if description:
            payload["description"] = description
    
        response = make_devrev_request(
            "parts.create",
            payload
        )
    
        if response.status_code != 201:
            error_text = response.text
            return [
                types.TextContent(
                    type="text",
                    text=f"Create part failed with status {response.status_code}: {error_text}"
                )
            ]
        
        return [
            types.TextContent(
                type="text",
                text=f"Part created successfully: {response.json()}"
            )
        ]
  • Registration of the 'create_part' tool in the list_tools handler, including name, description, and JSON schema for input validation.
        name="create_part",
        description="Create a new part (enhancement) in DevRev",
        inputSchema={
            "type": "object",
            "properties": {
                "type": {"type": "string", "enum": ["enhancement"]},
                "name": {"type": "string"},
                "owned_by": {"type": "array", "items": {"type": "string"}, "description": "The DevRev IDs of the users assigned to the part"},
                "parent_part": {"type": "array", "items": {"type": "string"}, "description": "The DevRev IDs of the parent parts"},
                "description": {"type": "string", "description": "The description of the part"},
            },
            "required": ["type", "name", "owned_by", "parent_part"],
        },
    ),
  • Utility function used by the create_part handler to make authenticated POST requests to DevRev API endpoints, including 'parts.create'.
    def make_devrev_request(endpoint: str, payload: Dict[str, Any]) -> requests.Response:
        """
        Make an authenticated request to the DevRev API.
        
        Args:
            endpoint: The API endpoint path (e.g., "works.get" or "search.hybrid")
            payload: The JSON payload to send
        
        Returns:
            requests.Response object
        
        Raises:
            ValueError: If DEVREV_API_KEY environment variable is not set
        """
        api_key = os.environ.get("DEVREV_API_KEY")
        if not api_key:
            raise ValueError("DEVREV_API_KEY environment variable is not set")
    
        headers = {
            "Authorization": f"{api_key}",
            "Content-Type": "application/json",
        }
        
        return requests.post(
            f"https://api.devrev.ai/{endpoint}",
            headers=headers,
            json=payload
        ) 

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/devrev/mcp-server'

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