Skip to main content
Glama
gabrielserrao

pyResToolbox MCP Server

gas_viscosity

Calculate gas viscosity at reservoir conditions using the Lee-Gonzalez-Eakin correlation for accurate flow rate and pressure drop analysis in petroleum engineering.

Instructions

Calculate gas viscosity (μg).

CRITICAL GAS PVT PROPERTY - Computes gas viscosity at reservoir conditions using Lee, Gonzalez & Eakin (1966) correlation, industry standard for natural gas. Viscosity affects flow rates, pressure drops, and well performance. Gas viscosity increases with pressure and temperature, opposite to liquid behavior.

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

Viscosity Behavior:

  • Increases with pressure (gas molecules closer together)

  • Increases with temperature (molecular motion increases)

  • Typical range: 0.01-0.05 cP at reservoir conditions

  • At standard conditions: ~0.01 cP

Lee-Gonzalez-Eakin Correlation: Uses Z-factor internally to account for real gas behavior. More accurate than ideal gas assumptions, especially at high pressures.

Returns: Dictionary with:

  • value (float or list): Viscosity in cP (matches input p shape)

  • method (str): "Lee-Gonzalez-Eakin"

  • units (str): "cP"

  • 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 viscosity (increases with P) with oil viscosity (decreases with P)

  • 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: Viscosity increases from ~0.012 cP at 1000 psia to ~0.025 cP at 4000 psia.

Note: Gas viscosity is much lower than oil viscosity (typically 0.01-0.05 cP vs 0.5-10 cP). 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 the correlation method used, typical viscosity ranges (0.01-0.05 cP), how viscosity changes with pressure/temperature, the tool's accuracy advantages over ideal gas assumptions, and detailed return format. It also covers practical considerations like unit requirements and component accounting.

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, Viscosity Behavior, Correlation, Returns, Common Mistakes, Example) but is quite lengthy. While every section adds value, some information could be more condensed. The front-loading is good with purpose and criticality stated immediately.

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?

For a complex calculation tool with 7 parameters, 0% schema coverage, and no annotations, the description provides exceptional completeness. It covers purpose, usage, parameters, behavior, methodology, return format, common mistakes, and examples. The output schema exists but the description still usefully explains the return structure and units.

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?

Despite 0% schema description coverage, the description provides comprehensive parameter documentation: valid ranges, typical values, examples, optional/default values, and practical explanations for each parameter. It adds significant meaning beyond the bare schema, including the 'zmethod' options with recommendation and clarification that 'p' can be scalar or array.

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 viscosity using the Lee, Gonzalez & Eakin correlation, specifying it's for natural gas at reservoir conditions. It distinguishes itself from sibling tools like 'oil_viscosity' by explicitly contrasting gas vs. oil viscosity behavior and mentioning it's a critical PVT property for flow rates and pressure drops.

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 specifies it's for gas (not oil), at reservoir conditions (not separator conditions), and uses real gas behavior (not ideal gas). It also warns against common mistakes like using wrong temperature units or pressure types, which implicitly defines when not to use it.

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