Skip to main content
Glama
fair2wise

Materials Project MCP

by fair2wise

get_materials_with_elements

Identify materials containing specific elements while optionally excluding unwanted elements using the Materials Project database, returning up to a defined number of records for targeted research.

Instructions

Find materials containing specific elements. Args: elements: List of elements that must be present in the material (e.g., ["Fe", "O"]). exclude_elements: Optional list of elements that must not be present. max_records: Maximum number of records to return (default: 10). Returns: List of materials containing the specified elements.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
elementsYes
exclude_elementsNo
max_recordsNo

Implementation Reference

  • The handler function implementing the get_materials_with_elements tool. It calls the API wrapper fetch_materials_by_elements and processes the results into a simplified format.
    def get_materials_with_elements( elements: List[str], exclude_elements: Optional[List[str]] = None, max_records: int = 10 ) -> List[Dict[str, Any]]: """ Find materials containing specific elements. Args: elements: List of elements that must be present in the material (e.g., ["Fe", "O"]). exclude_elements: Optional list of elements that must not be present. max_records: Maximum number of records to return (default: 10). Returns: List of materials containing the specified elements. """ properties = [ "material_id", "formula_pretty", "symmetry", "formation_energy_per_atom", "band_gap", "density", "is_stable" ] materials = fetch_materials_by_elements( elements=elements, exclude_elements=exclude_elements, max_records=max_records, properties=properties ) # Extract key properties for each material simplified_results = [] for material in materials: simplified_material = { "material_id": material.get("material_id"), "formula": material.get("formula_pretty"), "band_gap": material.get("band_gap"), "formation_energy": material.get("formation_energy_per_atom"), "crystal_system": material.get("symmetry", {}).get("crystal_system"), "space_group": material.get("symmetry", {}).get("symbol"), "density": material.get("density"), "is_stable": material.get("is_stable", False) } simplified_results.append(simplified_material) return simplified_results
  • Registers the get_materials_with_elements tool with the FastMCP instance.
    mcp.tool(get_materials_with_elements)

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