Skip to main content
Glama
gabrielserrao

pyResToolbox MCP Server

gas_formation_volume_factor

Calculate gas formation volume factor (Bg) to convert gas volumes between reservoir and standard conditions for material balance, reserve estimation, and production forecasting in petroleum engineering.

Instructions

Calculate gas formation volume factor (Bg).

CRITICAL GAS PVT PROPERTY - Computes ratio of gas volume at reservoir conditions to volume at standard conditions. Bg << 1.0 because gas compresses significantly at reservoir pressure. Essential for material balance, reserve calculations, and production forecasting.

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 Bg calculation. Options: "DAK", "HY", "WYW", "BUR". DAK recommended.

Bg Behavior:

  • Bg decreases with increasing pressure (gas compresses)

  • Bg increases with increasing temperature (gas expands)

  • Typical range: 0.001-0.01 rcf/scf at reservoir conditions

  • At standard conditions (14.7 psia, 60°F): Bg = 1.0 rcf/scf

Formula: Bg = (Z × T × Psc) / (P × Tsc) = 0.02827 × Z × T / P (field units)

Where:

  • Z = gas compressibility factor (from gas_z_factor tool)

  • T = reservoir temperature (°R)

  • P = reservoir pressure (psia)

  • Psc = 14.7 psia, Tsc = 520°R (standard conditions)

Returns: Dictionary with:

  • value (float or list): Bg in rcf/scf (matches input p shape)

  • method (str): Z-factor method used

  • units (str): "rcf/scf"

  • 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 Bg (gas FVF) with Bo (oil FVF)

  • 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,
    "zmethod": "DAK"
}

Result: Bg decreases from ~0.005 rcf/scf at 1000 psia to ~0.002 rcf/scf at 4000 psia.

Note: Bg is inversely proportional to pressure. Always use reservoir conditions, not separator conditions. Account for all non-hydrocarbon components for accuracy.

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 explains Bg behavior (decreases with pressure, increases with temperature), typical ranges (0.001-0.01 rcf/scf), formula details, return structure, common mistakes, and critical notes about using reservoir conditions. This provides comprehensive behavioral context beyond basic calculation.

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, Bg Behavior, Formula, Returns, Common Mistakes, Example Usage, Note) and every sentence adds value. While comprehensive, it's appropriately sized for a complex tool with many parameters and no annotations, though slightly lengthy.

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, 7 parameters with 0% schema coverage, no annotations, but with output schema, the description is exceptionally complete. It covers purpose, parameters, behavior, formula, returns, common mistakes, examples, and critical usage notes, providing everything needed for correct 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?

With 0% schema description coverage, the description fully compensates by providing detailed parameter information: valid ranges, typical values, examples, optional/default values, and zmethod options. It adds significant meaning beyond the bare schema, including practical guidance like pressure must be absolute (psia) not barg/psig.

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 the gas formation volume factor (Bg), specifying it's a critical PVT property that computes the ratio of gas volume at reservoir to standard conditions. It distinguishes from siblings like oil_formation_volume_factor by explicitly mentioning gas-specific behavior and common confusion with oil FVF.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool (material balance, reserve calculations, production forecasting) and mentions using the gas_z_factor tool for Z calculations. However, it doesn't explicitly state when NOT to use it or name specific alternative tools among siblings for related calculations.

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