Skip to main content
Glama
HeshamFS

MCP Materials Server

by HeshamFS

get_elastic_properties

Retrieve elastic and mechanical properties for materials using Materials Project IDs. Returns bulk modulus, shear modulus, Young's modulus, Poisson's ratio, and elastic tensor data.

Instructions

Get elastic and mechanical properties for a material.

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

Returns:
    JSON with elastic properties including bulk modulus, shear modulus,
    Young's modulus, Poisson's ratio, and elastic tensor

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
material_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function for the 'get_elastic_properties' tool. Decorated with @mcp.tool() for automatic registration and schema inference from signature/docstring. Fetches elasticity data from Materials Project API via MPRester.materials.elasticity.search and extracts key mechanical properties like moduli and Poisson's ratio.
    @mcp.tool()
    def get_elastic_properties(
        material_id: str,
    ) -> str:
        """
        Get elastic and mechanical properties for a material.
    
        Args:
            material_id: Materials Project ID (e.g., "mp-149" for Silicon)
    
        Returns:
            JSON with elastic properties including bulk modulus, shear modulus,
            Young's modulus, Poisson's ratio, and elastic tensor
        """
        has_key, key_or_error = check_api_key()
        if not has_key:
            return json.dumps({"error": key_or_error})
    
        try:
            from mp_api.client import MPRester
    
            with MPRester(key_or_error) as mpr:
                # Get elasticity data
                docs = mpr.materials.elasticity.search(
                    material_ids=[material_id],
                )
    
                if not docs:
                    return json.dumps({
                        "material_id": material_id,
                        "error": "No elastic data available for this material",
                        "note": "Elastic properties are only computed for a subset of materials",
                    })
    
                doc = docs[0]
    
                # Extract elastic properties
                properties = {
                    "material_id": material_id,
                    "formula": doc.formula_pretty if hasattr(doc, 'formula_pretty') else None,
    
                    # Voigt-Reuss-Hill averages (most commonly used)
                    "bulk_modulus_vrh_GPa": doc.bulk_modulus.vrh if doc.bulk_modulus else None,
                    "shear_modulus_vrh_GPa": doc.shear_modulus.vrh if doc.shear_modulus else None,
                    "youngs_modulus_GPa": doc.young_modulus if hasattr(doc, 'young_modulus') else None,
                    "poisson_ratio": doc.homogeneous_poisson if hasattr(doc, 'homogeneous_poisson') else None,
    
                    # Voigt bounds (upper)
                    "bulk_modulus_voigt_GPa": doc.bulk_modulus.voigt if doc.bulk_modulus else None,
                    "shear_modulus_voigt_GPa": doc.shear_modulus.voigt if doc.shear_modulus else None,
    
                    # Reuss bounds (lower)
                    "bulk_modulus_reuss_GPa": doc.bulk_modulus.reuss if doc.bulk_modulus else None,
                    "shear_modulus_reuss_GPa": doc.shear_modulus.reuss if doc.shear_modulus else None,
    
                    # Derived properties
                    "universal_anisotropy": doc.universal_anisotropy if hasattr(doc, 'universal_anisotropy') else None,
                    "debye_temperature_K": doc.debye_temperature if hasattr(doc, 'debye_temperature') else None,
    
                    # Classification - convert enum to string
                    "state": str(doc.state.value) if hasattr(doc, 'state') and hasattr(doc.state, 'value') else (str(doc.state) if hasattr(doc, 'state') else None),
                }
    
                # Add elastic tensor if available (6x6 Voigt notation)
                if hasattr(doc, 'elastic_tensor') and doc.elastic_tensor:
                    tensor = doc.elastic_tensor
                    if hasattr(tensor, 'ieee_format'):
                        properties["elastic_tensor_GPa"] = tensor.ieee_format
                    elif hasattr(tensor, 'raw'):
                        properties["elastic_tensor_GPa"] = tensor.raw
    
                return json.dumps(properties, indent=2)
    
        except Exception as e:
            return json.dumps({"error": str(e)})
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It describes a read operation ('Get') and specifies the return format, but doesn't cover important aspects like error handling, rate limits, authentication needs, or whether the data is cached or real-time. For a tool with no annotations, this leaves significant gaps in understanding its behavior.

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 well-structured and concise, with a clear purpose statement followed by 'Args:' and 'Returns:' sections. Every sentence adds value, and it's front-loaded with the main functionality. There's no wasted text, making it efficient for an agent to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema (as per context signals), the description doesn't need to detail return values, and it adequately covers the input parameter. However, with no annotations and a read operation that might involve complex data retrieval, it could benefit from more behavioral context (e.g., data freshness, limitations). Overall, it's mostly complete but has minor gaps.

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 meaningful context for the single parameter 'material_id' by explaining it's a 'Materials Project ID' and providing an example ('e.g., "mp-149" for Silicon'). Since schema description coverage is 0% and there's only one parameter, this compensates well, giving the agent clear guidance on what to input.

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: 'Get elastic and mechanical properties for a material.' It specifies the verb ('Get'), resource ('elastic and mechanical properties'), and target ('a material'). However, it doesn't explicitly differentiate from sibling tools like 'get_properties' or 'search_by_elastic_properties', which might have overlapping functionality, so it misses the highest score.

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, prerequisites, or specific contexts for usage. The only implied usage is for retrieving elastic properties, but without explicit comparisons or exclusions, it lacks sufficient guidance.

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

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/HeshamFS/mcp-materials-server'

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