Skip to main content
Glama
fair2wise

Materials Project MCP

by fair2wise

get_material_details

Retrieve comprehensive material details using the Materials Project ID to access properties, structures, and compositions for research or analysis purposes.

Instructions

Get detailed information about a specific material by its Materials Project ID.

Args:
    material_id: The Materials Project ID (e.g., "mp-149").

Returns:
    Dictionary containing detailed information about the material.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
material_idYes

Implementation Reference

  • The core handler function 'get_material_details' that executes the tool logic: fetches material data via API wrapper and formats key properties into a structured dictionary.
    def get_material_details(material_id: str) -> Dict[str, Any]:
        """
        Get detailed information about a specific material by its Materials Project ID.
        
        Args:
            material_id: The Materials Project ID (e.g., "mp-149").
        
        Returns:
            Dictionary containing detailed information about the material.
        """
        properties = [
            "material_id", 
            "formula_pretty",
            "symmetry", 
            "formation_energy_per_atom",
            "band_gap",
            "density",
            "is_stable",
            "energy_above_hull",
            "theoretical",
            "nelements",
            "elements",
            "nsites",
            "volume",
            "deprecated",
            "deprecation_reasons"
        ]
        
        material = fetch_material_by_id(
            material_id=material_id,
            properties=properties
        )
        
        # Format the output to make it more readable
        result = {
            "material_id": material.get("material_id"),
            "formula": material.get("formula_pretty"),
            "elements": material.get("elements"),
            "number_of_elements": material.get("nelements"),
            "number_of_sites": material.get("nsites"),
            "volume": material.get("volume"),
            "density": material.get("density"),
            "band_gap": material.get("band_gap"),
            "formation_energy": material.get("formation_energy_per_atom"),
            "energy_above_hull": material.get("energy_above_hull"),
            "is_stable": material.get("is_stable", False),
            "is_theoretical": material.get("theoretical", True),
            "crystal_system": material.get("symmetry", {}).get("crystal_system"),
            "space_group": material.get("symmetry", {}).get("symbol"),
            "point_group": material.get("symmetry", {}).get("point_group"),
            "deprecated": material.get("deprecated", False),
            "deprecation_reasons": material.get("deprecation_reasons", [])
        }
        
        return result
  • Registers the 'get_material_details' tool (along with others) with the FastMCP server instance.
    mcp.tool(get_materials_with_elements)
    mcp.tool(get_material_details)
    mcp.tool(find_materials_by_formula)
  • Supporting API wrapper 'fetch_material_by_id' that queries the Materials Project MPRester client and retrieves raw material data, invoked by the handler.
    def fetch_material_by_id(
        material_id: str,
        properties: Optional[List[str]] = None,
    ) -> Dict[str, Any]:
        """
        Fetch a specific material by its Materials Project ID.
        
        Args:
            material_id: The Materials Project ID (e.g., "mp-149").
            properties: Optional list of properties to include in the results.
        
        Returns:
            Dictionary containing the material data.
        """
        if properties is None:
            properties = [
                "material_id", 
                "formula_pretty",
                "symmetry", 
                "formation_energy_per_atom",
                "band_gap",
                "theoretical",
                "density",
                "is_stable",
                "energy_above_hull",
                "elements",
                "nelements",
                "nsites",
                "volume"
            ]
        
        with get_mp_client() as mpr:
            # Search by material_id
            docs = mpr.materials.summary.search(
                material_ids=[material_id],
                fields=properties
            )
            
            if not docs:
                return {"error": f"Material {material_id} not found"}
            
            # Convert to dictionary
            material_dict = docs[0].dict()
            
        return material_dict
Behavior2/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 retrieves information, implying a read-only operation, but lacks details on permissions, rate limits, error handling, or what specific information is included in the 'detailed information.' This is a significant gap for a tool with no annotation coverage.

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 appropriately sized and front-loaded, with a clear purpose statement followed by concise sections for Args and Returns. Every sentence adds value without redundancy, making it efficient and well-structured.

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 (single parameter, no output schema, no annotations), the description is adequate but has clear gaps. It explains the parameter well and states the return type, but without annotations or output schema, it lacks details on behavioral aspects like error cases or the structure of the returned dictionary, leaving room for improvement.

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

Parameters5/5

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

The description adds substantial meaning beyond the input schema, which has 0% coverage. It explains that material_id is a 'Materials Project ID' and provides an example ('mp-149'), clarifying the parameter's purpose and format, which compensates fully for the schema's lack of description.

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

Purpose5/5

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

The description clearly states the verb ('Get detailed information') and resource ('about a specific material by its Materials Project ID'), distinguishing it from sibling tools like find_materials_by_formula and get_materials_with_elements, which search by formula or elements rather than retrieving details by ID.

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

Usage Guidelines4/5

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

The description implies usage context by specifying 'by its Materials Project ID,' suggesting this tool is for retrieving details when you have a specific ID. However, it does not explicitly state when not to use it or name alternatives, such as using sibling tools for search instead.

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

Related 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/fair2wise/materials_project_mcp'

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