def lindorm_get_index_fields()

in src/lindorm_mcp_server/server.py [0:0]


def lindorm_get_index_fields(index_name: str, ctx: Context = None) -> str:
    """
    Get the fields info of the indexes(or knowledgebase), especially get the vector stored field and content stored field.
    :param index_name: the index name, or known as knowledgebase name
    :return: the index fields information
    """
    lindorm_search_client = ctx.request_context.lifespan_context.lindorm_search_client
    mapping = lindorm_search_client.get_index_mappings(index_name)
    fields_info = simplify_mappings(mapping, index_name)
    output = f"The structure(mapping) of index {index_name} is\n"
    output += json.dumps(fields_info, indent=2, ensure_ascii=False)
    return output