Skip to main content
Glama
devrev

DevRev MCP Server

Official
by devrev

search

Search DevRev for articles, issues, tickets, parts, users, accounts, organizations, vistae, or incidents using a specific query to find relevant information quickly.

Instructions

Search DevRev using the provided query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
namespaceYesThe namespace to search in. Use this to specify the type of object to search for.

Implementation Reference

  • The handler function that executes the 'search' tool logic. It validates input arguments, calls the DevRev API endpoint 'search.hybrid' using make_devrev_request, handles errors, and returns the search results as text content.
    elif name == "search": if not arguments: raise ValueError("Missing arguments") query = arguments.get("query") if not query: raise ValueError("Missing query parameter") namespace = arguments.get("namespace") if not namespace: raise ValueError("Missing namespace parameter") response = make_devrev_request( "search.hybrid", { "query": query, "namespace": namespace } ) if response.status_code != 200: error_text = response.text return [ types.TextContent( type="text", text=f"Search failed with status {response.status_code}: {error_text}" ) ] search_results = response.json() return [ types.TextContent( type="text", text=f"Search results for '{query}':\n{search_results}" ) ]
  • Registers the 'search' tool in the list_tools handler by including it in the returned list of tools, specifying its name, description, and input schema.
    types.Tool( name="search", description="Search DevRev using the provided query", inputSchema={ "type": "object", "properties": { "query": {"type": "string"}, "namespace": { "type": "string", "enum": ["article", "issue", "ticket", "part", "dev_user", "account", "rev_org", "vista", "incident"], "description": "The namespace to search in. Use this to specify the type of object to search for." }, }, "required": ["query", "namespace"], }, ),
  • Helper utility function used by the 'search' handler to make authenticated POST requests to DevRev API endpoints, specifically 'search.hybrid' as documented.
    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