Skip to main content
Glama

get_index_info

Retrieve metadata for a specific Splunk index to understand its configuration and properties.

Instructions

Get metadata for a specific Splunk index.

Args:
    index_name: Name of the index to get metadata for
    
Returns:
    Dictionary containing index metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
index_nameYes

Implementation Reference

  • The handler function that implements the get_index_info tool logic. It retrieves metadata for a specified Splunk index including event count, sizes, and time ranges. The @mcp.tool() decorator registers it as an MCP tool.
    @mcp.tool()
    async def get_index_info(index_name: str) -> Dict[str, Any]:
        """
        Get metadata for a specific Splunk index.
        
        Args:
            index_name: Name of the index to get metadata for
            
        Returns:
            Dictionary containing index metadata
        """
        try:
            service = get_splunk_connection()
            index = service.indexes[index_name]
            
            return {
                "name": index_name,
                "total_event_count": str(index["totalEventCount"]),
                "current_size": str(index["currentDBSizeMB"]),
                "max_size": str(index["maxTotalDataSizeMB"]),
                "min_time": str(index["minTime"]),
                "max_time": str(index["maxTime"])
            }
        except KeyError:
            logger.error(f"❌ Index not found: {index_name}")
            raise ValueError(f"Index not found: {index_name}")
        except Exception as e:
            logger.error(f"❌ Failed to get index info: {str(e)}")
            raise
  • splunk_mcp.py:396-396 (registration)
    The @mcp.tool() decorator registers the get_index_info function as an MCP tool.
    @mcp.tool()
  • Helper function used by get_index_info to establish Splunk connection.
    def get_splunk_connection() -> splunklib.client.Service:
        """
        Get a connection to the Splunk service.
        Supports both username/password and token-based authentication.
        If SPLUNK_TOKEN is set, it will be used for authentication and username/password will be ignored.
        Returns:
            splunklib.client.Service: Connected Splunk service
        """
        try:
            if SPLUNK_TOKEN:
                logger.debug(f"🔌 Connecting to Splunk at {SPLUNK_SCHEME}://{SPLUNK_HOST}:{SPLUNK_PORT} using token authentication")
                service = splunklib.client.connect(
                    host=SPLUNK_HOST,
                    port=SPLUNK_PORT,
                    scheme=SPLUNK_SCHEME,
                    verify=VERIFY_SSL,
                    token=f"Bearer {SPLUNK_TOKEN}"
                )
            else:
                username = os.environ.get("SPLUNK_USERNAME", "admin")
                logger.debug(f"🔌 Connecting to Splunk at {SPLUNK_SCHEME}://{SPLUNK_HOST}:{SPLUNK_PORT} as {username}")
                service = splunklib.client.connect(
                    host=SPLUNK_HOST,
                    port=SPLUNK_PORT,
                    username=username,
                    password=SPLUNK_PASSWORD,
                    scheme=SPLUNK_SCHEME,
                    verify=VERIFY_SSL
                )
            logger.debug(f"✅ Connected to Splunk successfully")
            return service
        except Exception as e:
            logger.error(f"❌ Failed to connect to Splunk: {str(e)}")
            raise
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states it 'gets metadata' which implies a read-only operation, but doesn't specify permissions required, rate limits, error conditions, or what specific metadata fields are returned. The return format is vaguely described as a 'dictionary', lacking detail on structure or content.

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

Conciseness4/5

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

The description is efficiently structured with a clear purpose statement followed by Args and Returns sections. Every sentence serves a purpose: the first states the tool's function, the second explains the parameter, and the third describes the return. No redundant or verbose language is present.

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

Completeness3/5

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

For a single-parameter read operation with no annotations and no output schema, the description provides basic purpose and parameter explanation but lacks sufficient behavioral context. It doesn't detail what metadata is included, error handling, or authentication requirements, leaving gaps for an agent to use the tool effectively without additional context.

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

Parameters3/5

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

Schema description coverage is 0%, but the description compensates by explaining the single parameter 'index_name' as 'Name of the index to get metadata for', adding semantic meaning beyond the schema's title 'Index Name'. However, it doesn't provide format examples, constraints, or validation rules for the index name parameter.

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

Purpose4/5

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

The description clearly states the verb 'Get' and resource 'metadata for a specific Splunk index', making the purpose unambiguous. It distinguishes from siblings like 'list_indexes' (which lists multiple indexes) by focusing on metadata retrieval for a single specified index. However, it doesn't explicitly contrast with 'get_indexes_and_sourcetypes' which might overlap in functionality.

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

Usage Guidelines3/5

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

The description implies usage when you need metadata for a specific index (vs. listing indexes), but doesn't provide explicit guidance on when to choose this tool over alternatives like 'get_indexes_and_sourcetypes' or 'list_indexes'. No prerequisites, exclusions, or comparative context are mentioned, leaving usage decisions to inference.

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/livehybrid/splunk-mcp'

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