Skip to main content
Glama
seohyunjun

OpenSearch MCP Server

by seohyunjun

get_tasks

Retrieve current tasks running in an OpenSearch cluster to monitor operations and manage cluster performance.

Instructions

Get current tasks in cluster

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The async handler function for the 'get_tasks' MCP tool. It fetches current tasks from the OpenSearch cluster using cat.tasks, filters duplicates by task type, and returns unique tasks as TextContent.
    @mcp.tool(description="Get current tasks in cluster")
    async def get_tasks() -> list[TextContent]:
        """
        Get current tasks running in the cluster.
        Filters duplicate task types to show only unique operations.
        """
        self.logger.info("Fetching cluster tasks...")
        try:
            response = self.es_client.cat.tasks(v=True)
            lines = response.split('\n')
            seen_tasks = set()
            filtered_lines = []
            
            for line in lines:
                if not line.strip():
                    continue
                task_type = line.split()[0]
                if task_type not in seen_tasks:
                    seen_tasks.add(task_type)
                    filtered_lines.append(line)
                    
            if filtered_lines:
                return [TextContent(type="text", text='\n'.join(filtered_lines))]
            else:
                return [TextContent(type="text", text="No tasks currently running in the cluster.")]
        except Exception as e:
            self.logger.error(f"Error fetching tasks: {e}")
            return [TextContent(type="text", text=f"Error: {str(e)}")]
  • Registration of AdminClusterTools, which includes the get_tasks tool, by calling register_tools on the MCP instance.
    admin_cluster_tools.register_tools(self.mcp)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states 'Get current tasks' but doesn't clarify if this is a read-only operation, what permissions might be required, whether it's real-time or cached data, or any rate limits. For a tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence: 'Get current tasks in cluster'. It's front-loaded with the core action and resource, with zero wasted words. Every part of the sentence contributes directly to the tool's purpose, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of cluster tasks and the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'tasks' entail, the format or structure of the returned data, or any behavioral aspects like error handling. For a tool in a monitoring context with siblings that might overlap, more context is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so the schema fully documents the lack of inputs. The description doesn't need to add parameter details, and it correctly implies no parameters are required by not mentioning any. This aligns well with the schema, earning a baseline score above 3 due to the absence of parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get current tasks in cluster' states a clear verb ('Get') and resource ('tasks in cluster'), but it's vague about scope and lacks differentiation from potential sibling tools. It doesn't specify what types of tasks (e.g., indexing, search, administrative) or what 'current' means temporally, which could be important given siblings like 'get_cluster_stats' and 'get_recovery_status' that might overlap in monitoring functions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'get_cluster_health', 'get_cluster_stats', and 'get_recovery_status', which might also provide task-related insights, there's no indication of when this specific tool is appropriate, leaving the agent to guess based on the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/seohyunjun/opensearch-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server