search_endpoints
Find API endpoints by searching path, description, or tags within OpenAPI schemas. Filter results by HTTP methods, authentication requirements, tags, and deprecation status.
Instructions
Search endpoints by query in path, description, or tags
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| api | Yes | API name or direct URL | |
| query | Yes | Search query | |
| page | No | Page number (1-based) | |
| page_size | No | Items per page (max 100) | |
| methods | No | Filter by HTTP methods (e.g., ['GET', 'POST']) | |
| tags_include | No | Include endpoints with these tags | |
| tags_exclude | No | Exclude endpoints with these tags | |
| has_authentication | No | Filter by authentication requirement | |
| deprecated | No | Filter by deprecation status |
Implementation Reference
- The handle_call method implements the core logic of the search_endpoints tool. It validates the API identifier, extracts pagination and filter parameters, calls the explorer service for paginated search results, formats the response, and handles errors.async def handle_call(self, arguments: Dict[str, Any]) -> List[TextContent]: try: self._validate_api_identifier(arguments["api"]) pagination = self.extract_pagination_params(arguments) filters = self.extract_endpoint_filter_params(arguments) paginated_result = await self.explorer.search_endpoints_paginated( arguments["api"], arguments["query"], pagination, filters ) result = self._format_paginated_search_response( paginated_result, arguments["query"], filters ) return self._create_text_response(result) except Exception as e: return self._create_error_response(e)
- Defines the tool definition including name, description, and input schema for the search_endpoints tool using create_paginated_search_input_schema().def get_tool_definition(self) -> Tool: return Tool( name=self.name, description=self.description, inputSchema=self.create_paginated_search_input_schema(), )
- openapi_mcp_proxy/services/tool_registry.py:47-47 (registration)Instantiates the SearchEndpointsTool with config_manager and explorer, adding it to the list of tools registered in the ToolRegistry.SearchEndpointsTool(self.config_manager, self.explorer),
- The search_endpoints_paginated method in OpenAPIExplorer performs the actual endpoint searching, filtering by query and additional filters, applies pagination, and returns a PaginationResult. This is called by the tool handler.async def search_endpoints_paginated( self, api_identifier: str, query: str, pagination: PaginationParams, filters: Optional[EndpointFilterParams] = None, ) -> PaginationResult[EndpointInfo]: """Search endpoints with pagination and filtering.""" all_endpoints = await self.list_endpoints(api_identifier) query_filtered = [ep for ep in all_endpoints if ep.matches_query(query)] if filters: filtered_endpoints = [ ep for ep in query_filtered if ep.matches_filters(filters) ] else: filtered_endpoints = query_filtered total_count = len(filtered_endpoints) start_idx = pagination.get_offset() end_idx = start_idx + pagination.get_limit() paginated_endpoints = filtered_endpoints[start_idx:end_idx] logger.info( f"Paginated search for '{query}' in API {api_identifier}: " f"page {pagination.page}, showing {len(paginated_endpoints)} of {total_count}" ) return PaginationResult.create(paginated_endpoints, total_count, pagination)