general_api_request
Execute custom HTTP requests to Elasticsearch/OpenSearch APIs not covered by specific tools, enabling flexible cluster interactions.
Instructions
Perform a general HTTP API request. Use this tool for any Elasticsearch/OpenSearch API that does not have a dedicated tool.
Args:
method: HTTP method (GET, POST, PUT, DELETE, etc.)
path: API endpoint path
params: Query parameters
body: Request body
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method | Yes | ||
| path | Yes | ||
| params | No | ||
| body | No |
Implementation Reference
- src/tools/general.py:9-20 (handler)The handler function for the MCP tool 'general_api_request'. It delegates the API request to the search client's general_api_request method.@mcp.tool() def general_api_request(method: str, path: str, params: Optional[Dict] = None, body: Optional[Dict] = None): """Perform a general HTTP API request. Use this tool for any Elasticsearch/OpenSearch API that does not have a dedicated tool. Args: method: HTTP method (GET, POST, PUT, DELETE, etc.) path: API endpoint path params: Query parameters body: Request body """ return self.search_client.general_api_request(method, path, params, body)
- src/tools/general.py:8-21 (registration)The registration of the 'general_api_request' tool occurs within the GeneralTools class's register_tools method using the @mcp.tool() decorator.def register_tools(self, mcp: FastMCP): @mcp.tool() def general_api_request(method: str, path: str, params: Optional[Dict] = None, body: Optional[Dict] = None): """Perform a general HTTP API request. Use this tool for any Elasticsearch/OpenSearch API that does not have a dedicated tool. Args: method: HTTP method (GET, POST, PUT, DELETE, etc.) path: API endpoint path params: Query parameters body: Request body """ return self.search_client.general_api_request(method, path, params, body)
- src/clients/common/general.py:6-11 (helper)Helper function in GeneralClient that implements the core logic by calling self.general_client.request.def general_api_request(self, method: str, path: str, params: Optional[Dict] = None, body: Optional[Dict] = None): """Perform a general HTTP API request. Use this tool for any Elasticsearch/OpenSearch API that does not have a dedicated tool. """ return self.general_client.request(method, path, params, body)
- src/risk_config.py:28-30 (helper)Risk configuration identifying 'general_api_request' as a high-risk operation for GeneralTools."GeneralTools": { "general_api_request", },