Skip to main content
Glama
gabrielserrao

pyResToolbox MCP Server

gas_z_factor

Calculate gas compressibility factor (Z-factor) to correct ideal gas law for real gas behavior in reservoir engineering applications.

Instructions

Calculate gas compressibility factor (Z-factor).

CRITICAL GAS PVT PROPERTY - The Z-factor corrects the ideal gas law (PV=nRT) for real gas behavior. Z = 1.0 for ideal gas, Z < 1.0 for most real gases at reservoir conditions. Essential for all gas reservoir calculations including material balance, reserve estimation, and flow calculations.

Parameters:

  • sg (float, required): Gas specific gravity (air=1.0). Valid: 0.55-3.0. Typical: 0.6-1.2. Example: 0.7 for dry gas, 0.85 for associated gas.

  • degf (float, required): Reservoir temperature in °F. Valid: -460 to 1000. Typical: 100-400°F. Example: 180.0.

  • p (float or list, required): Pressure(s) in psia. Must be > 0. Can be scalar or array. Example: 3500.0 or [1000, 2000, 3000, 4000].

  • h2s (float, optional, default=0.0): H2S mole fraction (0-1). Typical: 0-0.05. Example: 0.02 for 2% H2S. High H2S requires special handling.

  • co2 (float, optional, default=0.0): CO2 mole fraction (0-1). Typical: 0-0.20. Example: 0.05 for 5% CO2.

  • n2 (float, optional, default=0.0): N2 mole fraction (0-1). Typical: 0-0.10. Example: 0.01 for 1% N2.

  • method (str, optional, default="DAK"): Correlation method. Options: "DAK", "HY", "WYW", "BUR". DAK recommended.

Z-Factor Behavior:

  • Low pressure: Z ≈ 1.0 (ideal gas behavior)

  • Medium pressure: Z < 1.0 (attractive forces dominate)

  • High pressure: Z > 1.0 (repulsive forces dominate)

  • Typical range: 0.7-1.2 for reservoir conditions

Method Selection:

  • DAK (Dranchuk & Abou-Kassem 1975): RECOMMENDED. Most accurate, widely validated. Use for: All applications, high accuracy requirements.

  • HY (Hall & Yarborough 1973): Classic method, fast. Use for: Quick estimates, compatibility with older methods.

  • WYW (Wang, Ye & Wu 2021): Newer correlation. Use for: Comparison studies, modern applications.

  • BUR (Burrows 1981): Alternative method. Use for: Specific regional correlations.

Non-Hydrocarbon Effects:

  • H2S and CO2 increase Z-factor (reduce compressibility)

  • N2 has minimal effect

  • For sour gas (H2S > 5%), use Wichert-Aziz correction (not included here)

Returns: Dictionary with:

  • value (float or list): Z-factor (dimensionless, matches input p shape)

  • method (str): Method used

  • units (str): "dimensionless"

  • inputs (dict): Echo of input parameters

Common Mistakes:

  • Using separator temperature instead of reservoir temperature

  • Pressure in barg/psig instead of psia (must be absolute)

  • Not accounting for non-hydrocarbon fractions (H2S, CO2, N2)

  • Using wrong gas gravity (must be separator gas gravity, not sales gas)

  • Temperature in Celsius instead of Fahrenheit

Example Usage:

{
    "sg": 0.7,
    "degf": 180.0,
    "p": [1000, 2000, 3000, 4000],
    "h2s": 0.0,
    "co2": 0.05,
    "n2": 0.01,
    "method": "DAK"
}

Result: Z decreases from ~0.95 at 1000 psia to ~0.85 at 3000 psia, then increases to ~0.90 at 4000 psia (typical behavior).

Note: Z-factor is critical for accurate gas calculations. Always use DAK method unless specific compatibility requirements exist. Account for all non-hydrocarbon components for accurate results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requestYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/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 thoroughly explains the tool's behavior: 'Z-Factor Behavior' section describes how Z varies with pressure, 'Non-Hydrocarbon Effects' explains how inputs affect results, 'Returns' details the output structure, and 'Common Mistakes' lists critical usage pitfalls. This covers behavioral aspects like input validation, output format, and error-prone scenarios.

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 with clear sections (Parameters, Z-Factor Behavior, Method Selection, etc.), making it easy to navigate. However, it is quite lengthy (over 500 words), which may be excessive for some contexts. Every sentence adds value, but it could be more front-loaded by moving the 'Returns' section earlier. The efficiency is high, but the overall size slightly impacts conciseness.

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

Completeness5/5

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

Given the tool's complexity (multiple parameters, no annotations, 0% schema coverage), the description is exceptionally complete. It covers purpose, usage, parameters, behavior, method selection, output format, common mistakes, and examples. The presence of an output schema (implied by 'Has output schema: true') is complemented by the detailed 'Returns' section. No gaps remain for effective tool invocation.

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?

Schema description coverage is 0%, so the description must fully compensate. It provides extensive parameter semantics: each parameter is documented with purpose, valid ranges, typical values, examples, and effects on calculation (e.g., 'H2S and CO2 increase Z-factor'). The 'Parameters' section adds meaning beyond basic schema types, including practical guidance like 'must be absolute' for pressure and 'separator gas gravity' for sg.

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 explicitly states the tool's purpose: 'Calculate gas compressibility factor (Z-factor).' It distinguishes this tool from siblings by specifying it's for gas (not oil/brine) and focuses on a specific PVT property, unlike general calculation tools in the list. The opening section emphasizes its critical role in gas reservoir calculations.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool vs. alternatives. It states: 'Essential for all gas reservoir calculations including material balance, reserve estimation, and flow calculations,' and includes a 'Method Selection' section with recommendations (e.g., 'DAK recommended,' 'Use for: All applications, high accuracy requirements'). It also warns about limitations: 'For sour gas (H2S > 5%), use Wichert-Aziz correction (not included here).'

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/gabrielserrao/pyrestoolbox-mcp'

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