Skip to main content
Glama

get_index_mappings

Retrieve the field structure and data types of an Elasticsearch index to understand its schema and data organization.

Instructions

Get the mappings of a specific Elasticsearch index.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexYes

Implementation Reference

  • The handler function for the 'get_index_mappings' tool. It retrieves the mapping schema for a specified Elasticsearch index using the Elasticsearch client. Includes error handling and logging.
    @mcp.tool() def get_index_mappings(index: str) -> dict: """Get the mappings of a specific Elasticsearch index.""" try: mappings = es.indices.get_mapping(index=index) return mappings.get(index, {}) except Exception as e: logger.error(f"Error getting mappings for index '{index}': {e}") return {"error": str(e)}
  • The @mcp.tool() decorator registers the get_index_mappings function as an MCP tool.
    @mcp.tool()

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/Akhilvis/elastic-mcp'

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