get_ism_policies
Retrieve Index State Management policies and their configurations from OpenSearch clusters to manage data lifecycle and automate index operations.
Instructions
Get ISM policies and their configurations
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The main handler function for the get_ism_policies tool. It is a nested async function decorated with @mcp.tool inside the register_tools method. Fetches ISM policies from OpenSearch endpoint '/_plugins/_ism/policies' and returns as list of TextContent.@mcp.tool(description="Get ISM policies and their configurations") async def get_ism_policies() -> list[TextContent]: """ Get Index State Management policies and their configurations. Returns policy IDs, descriptions, states, and index patterns. This result should be useful in determining index lifecycle management configurations such as index size limits, index rollover policy and retention policy. """ self.logger.info("Fetching ISM policies...") try: response = self.es_client.transport.perform_request( 'GET', '/_plugins/_ism/policies', params={'filter_path': 'policies.policy.policy_id,policies.policy.description,policies.policy.states,policies.policy.ism_template.index_patterns'} ) return [TextContent(type="text", text=str(response))] except Exception as e: self.logger.error(f"Error fetching ISM policies: {e}") return [TextContent(type="text", text=f"Error: {str(e)}")]
- src/opensearch_mcp_server/server.py:40-40 (registration)Invocation of register_tools on the AdminIndexTools instance in the main server, which triggers the registration of the get_ism_policies tool (and other admin index tools).admin_index_tools.register_tools(self.mcp)