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)
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 what the tool does (finds materials) and describes parameters, but lacks critical behavioral information: it doesn't mention whether this is a read-only operation, what data source it queries, potential rate limits, authentication requirements, or error conditions. The description is functional but incomplete for behavioral understanding.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and appropriately sized. It begins with a clear purpose statement, then lists parameters with brief explanations and examples, and concludes with return information. Every sentence adds value, though the 'Returns' section could be slightly more detailed given the lack of output schema.

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 moderate complexity (3 parameters, no annotations, no output schema), the description is adequate but has gaps. It covers parameters well and states the return type, but lacks behavioral context (e.g., data source, performance characteristics) and doesn't explain the format of returned materials. For a search tool with no structured metadata, more completeness would be beneficial.

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 description adds significant value beyond the input schema, which has 0% description coverage. It explains the meaning of all three parameters: 'elements' must be present, 'exclude_elements' must not be present, and 'max_records' limits results with a default. The examples (e.g., ["Fe", "O"]) and clarification of optionality are particularly helpful. Since schema coverage is low, the description effectively compensates.

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 tool's purpose: 'Find materials containing specific elements.' This is a specific verb+resource combination that distinguishes it from sibling tools like 'find_materials_by_formula' (which presumably searches by chemical formula) and 'get_material_details' (which retrieves details for specific materials). However, it doesn't explicitly contrast with siblings beyond the inherent difference in function.

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 sibling tools, suggest scenarios where this tool is appropriate, or warn against misuse. The only contextual information is the parameter descriptions, which don't constitute usage guidelines.

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