Skip to main content
Glama
devrev

DevRev MCP Server

Official
by devrev

get_part

Retrieve enhancement details from DevRev by providing its unique ID to access specific part information.

Instructions

Get information about a part (enhancement) in DevRev using its ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe DevRev ID of the part

Implementation Reference

  • The handler function within handle_call_tool that executes the 'get_part' tool. It extracts the 'id' argument, calls the DevRev API endpoint 'parts.get' using make_devrev_request, handles errors, and returns the part information as text content.
    elif name == "get_part":
        if not arguments:
            raise ValueError("Missing arguments")
    
        id = arguments.get("id")
        if not id:
            raise ValueError("Missing id parameter")
        
        response = make_devrev_request(
            "parts.get",
            {
                "id": id
            }
        )
    
        if response.status_code != 200:
            error_text = response.text
            return [
                types.TextContent(
                    type="text",
                    text=f"Get part failed with status {response.status_code}: {error_text}"
                )
            ]
        
        return [
            types.TextContent(
                type="text",
                text=f"Part information for '{id}':\n{response.json()}"
            )
        ]
  • Registers the 'get_part' tool in the list_tools handler, including its name, description, and input schema requiring a 'id' string.
    types.Tool(
        name="get_part",
        description="Get information about a part (enhancement) in DevRev using its ID",
        inputSchema={
            "type": "object",
            "properties": {"id": {"type": "string", "description": "The DevRev ID of the part"}},
            "required": ["id"],
        },
    ),
  • The JSON schema for the 'get_part' tool input, defining an object with a required 'id' property of type string.
    inputSchema={
        "type": "object",
        "properties": {"id": {"type": "string", "description": "The DevRev ID of the part"}},
        "required": ["id"],
    },
  • Helper utility function used by the get_part handler to make authenticated POST requests to the DevRev API, specifically called with endpoint 'parts.get'.
    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