Skip to main content
Glama
gabrielserrao

pyResToolbox MCP Server

gas_compressibility

Calculate gas compressibility coefficient for petroleum engineering applications. Determine how gas volume changes with pressure to support material balance calculations and reservoir analysis.

Instructions

Calculate gas compressibility (Cg).

CRITICAL GAS PVT PROPERTY - Computes gas compressibility coefficient, which measures how much gas volume changes with pressure. Essential for material balance calculations, pressure transient analysis, and reserve estimation. Gas compressibility is much higher than oil compressibility (typically 100-1000 × 10⁻⁶ 1/psi vs 5-50 × 10⁻⁶).

Parameters:

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

  • 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.

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

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

  • zmethod (str, optional, default="DAK"): Z-factor method for compressibility. Options: "DAK", "HY", "WYW", "BUR". DAK recommended.

Compressibility Behavior:

  • Decreases with increasing pressure (gas becomes less compressible)

  • Typical range: 50-500 × 10⁻⁶ 1/psi at reservoir conditions

  • At low pressure: Cg ≈ 1/P (ideal gas behavior)

  • At high pressure: Cg decreases significantly

Formula: Cg = (1/Z) × (∂Z/∂P) - (1/P)

Where Z-factor and its pressure derivative are calculated using specified method.

Returns: Dictionary with:

  • value (float or list): Compressibility in 1/psi (matches input p shape)

  • method (str): Z-factor method used

  • units (str): "1/psi"

  • 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

  • Confusing gas compressibility (high, 100-1000 × 10⁻⁶) with oil compressibility (low, 5-50 × 10⁻⁶)

  • Using ideal gas approximation (Cg = 1/P) instead of real gas

Example Usage:

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

Result: Cg decreases from ~1000 × 10⁻⁶ 1/psi at 1000 psia to ~250 × 10⁻⁶ 1/psi at 4000 psia.

Note: Gas compressibility is critical for material balance calculations. Always use reservoir conditions. Account for all non-hydrocarbon components. Cg values are small (micro-1/psi), so results are typically in scientific notation.

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 full burden and excels. It details behavioral traits: the formula used (Cg = (1/Z) × (∂Z/∂P) - (1/P)), how compressibility decreases with pressure, typical ranges (50-500 × 10⁻⁶ 1/psi), ideal gas behavior at low pressure, and the return format (dictionary with value, method, units, inputs).

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, Compressibility Behavior, Formula, Returns, Common Mistakes, Example Usage, Note) and front-loads the purpose. While comprehensive, it's appropriately sized for a complex tool, though slightly verbose; every sentence adds value, earning its place.

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, no annotations, and an output schema (which the description aligns with by detailing returns), the description is highly complete. It covers purpose, usage, parameters, behavior, formula, returns, common mistakes, and examples, leaving no gaps 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?

The schema has 0% description coverage, so the description fully compensates. It provides detailed semantics for all 7 parameters: purpose (e.g., 'Gas specific gravity'), valid ranges, typical values, examples, optional/default status, and for 'zmethod', it lists options and recommends 'DAK'. This adds substantial meaning beyond the bare schema.

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 tool calculates gas compressibility (Cg), specifying it's a critical PVT property that measures gas volume change with pressure. It distinguishes from sibling tools like 'oil_compressibility' by explicitly contrasting gas vs. oil compressibility ranges (100-1000 × 10⁻⁶ vs 5-50 × 10⁻⁶ 1/psi).

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 ('essential for material balance calculations, pressure transient analysis, and reserve estimation') and when not to use it ('confusing gas compressibility with oil compressibility'). It also lists common mistakes to avoid, effectively guiding usage versus alternatives.

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