Skip to content

Improve OpenSearchOps MCP endpoints for cluster debugging (new routes + better route descriptions) #1237

@simcariou

Description

@simcariou

Summary

OpenSearchOps currently covers basic OpenSearch diagnostics, but it is missing several read-only endpoints that are important for advanced cluster debugging (tasks, recovery, node info, thread pools, cluster settings/state/stats).

Since these routes are exposed via MCP, the OpenAPI route descriptions should also be improved so agents can better understand:

  • when to use each endpoint
  • differences between similar endpoints (e.g. pending_tasks vs tasks)
  • which endpoints may return large payloads

Requested Changes

1) Add new read-only endpoints

Add the following routes to OpenSearchOps:

  • GET /os/cluster/settings
  • GET /os/cluster/state
  • GET /os/cluster/stats
  • GET /os/nodes/info
  • GET /os/nodes/hot_threads
  • GET /os/tasks
  • GET /os/tasks/{task_id}
  • GET /os/cat/nodes
  • GET /os/cat/allocation
  • GET /os/cat/thread_pool
  • GET /os/recovery
  • GET /os/index/{index}/recovery

2) Improve MCP/OpenAPI route descriptions

Add detailed description= metadata to OpenSearchOps routes, with:

  • debugging use cases
  • endpoint selection guidance
  • payload-size warnings for heavy endpoints
  • explanation of wrapper behavior (especially /os/allocation/explain)

3) Fix /os/indices bytes parameter handling

Ensure the bytes query parameter is actually passed through (instead of being hardcoded to mb).

4) Add a small helper for query params (optional but recommended)

Introduce a helper (e.g. _build_query_params) to:

  • remove None query params
  • serialize booleans as true/false for OpenSearch

Constraints

  • Keep endpoints read-only
  • Keep existing auth/authorization checks (READ / OPENSEARCH)
  • Preserve current OpenSearch TransportError handling pattern
  • Keep OpenSearch tag so routes remain exported via MCP

Acceptance Criteria

  • New routes are available under the OpenSearch tag
  • OpenAPI descriptions are detailed enough for MCP agent usage
  • /os/indices?bytes=gb returns values in gb (not always mb)
  • No write/mutation OpenSearch routes are added
  • opensearch_controller.py passes Python syntax validation

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions