search
Search DevRev for articles, issues, or tickets using specific queries to find relevant information quickly.
Instructions
Search DevRev using the provided query
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| namespace | Yes |
Implementation Reference
- src/devrev_mcp/server.py:54-85 (handler)Executes the 'search' tool: validates 'query' and 'namespace' arguments, calls DevRev API via make_devrev_request('search.hybrid'), handles errors, and returns search results as text.if 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}" ) ]
- src/devrev_mcp/server.py:21-32 (registration)Registers the 'search' tool with the MCP server in list_tools(), providing name, description, and JSON schema for inputs (query: string, namespace: enum['article','issue','ticket']).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"]}, }, "required": ["query", "namespace"], }, ),
- src/devrev_mcp/server.py:24-31 (schema)JSON schema for 'search' tool inputs: object with required 'query' (string) and 'namespace' (enum: article, issue, ticket).inputSchema={ "type": "object", "properties": { "query": {"type": "string"}, "namespace": {"type": "string", "enum": ["article", "issue", "ticket"]}, }, "required": ["query", "namespace"], },
- src/devrev_mcp/utils.py:5-32 (helper)Helper utility to make authenticated POST requests to DevRev API endpoints like 'search.hybrid', used by the 'search' tool handler.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/internal/{endpoint}", headers=headers, json=payload )