Skip to main content
Glama
gabrielserrao

pyResToolbox MCP Server

evolved_gas_sg

Calculate evolved gas specific gravity for material balance, facility design, and gas sales forecasting as reservoir pressure declines below bubble point.

Instructions

Calculate evolved gas specific gravity.

Computes the specific gravity of gas evolved from oil as pressure decreases below bubble point. This is important for:

  • Material balance calculations

  • Surface facility design

  • Gas sales forecasting

The evolved gas composition changes with pressure, and this function accounts for that variation.

Returns dimensionless specific gravity (air = 1.0).

Args: request: Evolved gas parameters including oil properties, pressure(s), and separator conditions

Returns: Dictionary with evolved gas SG value(s), units, and inputs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requestYes

Implementation Reference

  • The main handler function for the 'evolved_gas_sg' tool. Decorated with @mcp.tool() for registration and executes the core logic using pyrestoolbox.oil.sg_evolved_gas.
    @mcp.tool() def evolved_gas_sg(request: EvolvedGasSGRequest) -> dict: """Calculate evolved gas specific gravity. Computes the specific gravity of gas evolved from oil as pressure decreases below bubble point. This is important for: - Material balance calculations - Surface facility design - Gas sales forecasting The evolved gas composition changes with pressure, and this function accounts for that variation. Returns dimensionless specific gravity (air = 1.0). Args: request: Evolved gas parameters including oil properties, pressure(s), and separator conditions Returns: Dictionary with evolved gas SG value(s), units, and inputs """ sg_evolved = oil.sg_evolved_gas( p=request.p, degf=request.degf, rsb=800.0, # Typical value api=request.api, sg_sp=request.sg_g, ) # Convert numpy array to list for JSON serialization if isinstance(sg_evolved, np.ndarray): value = sg_evolved.tolist() else: value = float(sg_evolved) return { "value": value, "method": "Valko-McCain correlation", "units": "dimensionless (air=1)", "inputs": request.model_dump(), }
  • Pydantic BaseModel defining the input schema (parameters and validation) for the evolved_gas_sg tool.
    class EvolvedGasSGRequest(BaseModel): """Request model for evolved gas specific gravity calculation.""" api: float = Field(..., gt=0, le=100, description="Oil API gravity (degrees)") degf: float = Field( ..., gt=-460, lt=1000, description="Temperature (degrees Fahrenheit)") sg_g: float = Field( ..., ge=0, le=3, description="Separator gas specific gravity") p: Union[float, List[float]] = Field( ..., description="Pressure (psia) - scalar or array") psep: float = Field(100.0, gt=0, description="Separator pressure (psia)") @field_validator("p") @classmethod def validate_pressure(cls, v): if isinstance(v, list): if not all(p > 0 for p in v): raise ValueError("All pressure values must be positive") else: if v <= 0: raise ValueError("Pressure must be positive") return v
  • The register_oil_tools function defines and registers all oil tools including evolved_gas_sg via @mcp.tool() decorators.
    def register_oil_tools(mcp: FastMCP) -> None: """Register all oil-related tools with the MCP server."""

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