Skip to main content
Glama

list_kvstore_collections

Retrieve all KV store collections with metadata including app, fields, and accelerated fields across Splunk applications.

Instructions

List all KV store collections across apps.

Returns:
    List of KV store collections with metadata including app, fields, and accelerated fields

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_kvstore_collections' MCP tool. Decorated with @mcp.tool(), which registers it with FastMCP. Lists all KV Store collections across Splunk apps, including metadata like fields, accelerated fields, app name, and record count. Uses get_splunk_connection() helper.
    @mcp.tool()
    async def list_kvstore_collections() -> List[Dict[str, Any]]:
        """
        List all KV store collections across apps.
        
        Returns:
            List of KV store collections with metadata including app, fields, and accelerated fields
        """
        try:
            service = get_splunk_connection()
            logger.info("📚 Fetching KV store collections...")
            
            collections = []
            app_count = 0
            collections_found = 0
            
            # Get KV store collection stats to retrieve record counts
            collection_stats = {}
            try:
                stats_response = service.get("/services/server/introspection/kvstore/collectionstats", output_mode="json")
                stats_data = json.loads(stats_response.body.read())
                if "entry" in stats_data and len(stats_data["entry"]) > 0:
                    entry = stats_data["entry"][0]
                    content = entry.get("content", {})
                    data = content.get("data", {})
                    for kvstore in data:
                        kvstore = json.loads(kvstore)
                        if "ns" in kvstore and "count" in kvstore:
                            collection_stats[kvstore["ns"]] = kvstore["count"]
                    logger.debug(f"✅ Retrieved stats for {len(collection_stats)} KV store collections")
            except Exception as e:
                logger.warning(f"⚠️ Error retrieving KV store collection stats: {str(e)}")
                
            try:
                for entry in service.kvstore:
                    try:
                        collection_name = entry['name']
                        fieldsList = [f.replace('field.', '') for f in entry['content'] if f.startswith('field.')]
                        accelFields = [f.replace('accelerated_field.', '') for f in entry['content'] if f.startswith('accelerated_field.')]
                        app_name = entry['access']['app']
                        collection_data = {
                            "name": collection_name,
                            "app": app_name,
                            "fields": fieldsList,
                            "accelerated_fields": accelFields,
                            "record_count": collection_stats.get(f"{app_name}.{collection_name}", 0)
                        }
                        collections.append(collection_data)
                        collections_found += 1
                        logger.debug(f"✅ Added collection: {collection_name} from app: {app_name}")
                    except Exception as e:
                        logger.warning(f"⚠️ Error processing collection entry: {str(e)}")
                        continue
                
                logger.info(f"✅ Found {collections_found} KV store collections")
                return collections
                
            except Exception as e:
                logger.error(f"❌ Error accessing KV store collections: {str(e)}")
                raise
                
        except Exception as e:
            logger.error(f"❌ Error listing KV store collections: {str(e)}")
            raise
  • splunk_mcp.py:603-603 (registration)
    The @mcp.tool() decorator registers the list_kvstore_collections function as an MCP tool.
    @mcp.tool()
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool lists collections and describes the return format, which is helpful. However, it lacks details on potential side effects, authentication needs, rate limits, or error handling, leaving gaps in behavioral context for a tool that might involve data access across apps.

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 extremely concise with only two sentences, front-loading the purpose and then detailing the return format. Every sentence earns its place by providing essential information without any wasted words or redundancy.

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?

Given the tool's complexity (listing collections across apps) and the absence of annotations and output schema, the description is minimally adequate. It covers the purpose and return format, but for a tool that might involve cross-app data access, more context on permissions, scope, or limitations would enhance completeness.

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 no parameter documentation is needed. The description appropriately focuses on the return values instead, adding value by specifying what metadata is included in the output, which compensates for the lack of an output schema.

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 action ('List all KV store collections') and the resource ('across apps'), which provides a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'list_indexes' or 'list_saved_searches', which would require mentioning what makes KV store collections distinct from those other resources.

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. It doesn't mention prerequisites, context for usage, or compare it to sibling tools like 'get_indexes_and_sourcetypes' or 'list_indexes', leaving the agent without explicit direction on selection criteria.

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