Skip to main content
Glama
devrev

DevRev MCP Server

Official
by devrev

search

Query DevRev to find specific items such as articles, issues, tickets, parts, users, accounts, organizations, or incidents by specifying the relevant namespace.

Instructions

Search DevRev using the provided query

Input Schema

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

Implementation Reference

  • The handler for the 'search' tool. Validates input arguments 'query' and 'namespace', makes an API request to DevRev's 'search.hybrid' endpoint using the make_devrev_request utility, and returns the search results as text content or an error message.
    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}" ) ]
  • Registration of the 'search' tool in the @server.list_tools() handler. Defines the tool name, description, and JSON schema for inputs: required 'query' (string) and 'namespace' (string enum specifying object type).
    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"], }, ),
  • Utility function imported and used by the 'search' handler to send authenticated POST requests to DevRev API endpoints, specifically 'search.hybrid' with the query and namespace payload.
    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