Skip to main content
Glama
gabrielserrao

pyResToolbox MCP Server

weighted_average_gas_sg

Calculate weighted average gas specific gravity from separator stages for surface facility design and gas sales allocation using separator and stock tank gas properties.

Instructions

Calculate weighted average gas specific gravity from separator stages.

SURFACE FACILITIES CALCULATION - Combines gas gravities from separator and stock tank weighted by GORs.

Use Cases:

  • Multi-stage separation optimization

  • Surface facility design

  • Gas sales allocation

  • Material balance

Formula: sg_avg = (sg_sp * rsp + sg_st * rst) / (rsp + rst)

Returns weighted average gas SG (dimensionless, air=1).

Args: request: Separator and stock tank gas properties

Returns: Dictionary with weighted average SG and breakdown

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requestYes

Implementation Reference

  • The core handler function for the 'weighted_average_gas_sg' tool. It is decorated with @mcp.tool() for automatic registration and computes the weighted average gas specific gravity using pyrestoolbox.oil.sgg_wt_avg.
    @mcp.tool() def weighted_average_gas_sg(request: WeightedAverageGasSGRequest) -> dict: """Calculate weighted average gas specific gravity from separator stages. **SURFACE FACILITIES CALCULATION** - Combines gas gravities from separator and stock tank weighted by GORs. **Use Cases:** - Multi-stage separation optimization - Surface facility design - Gas sales allocation - Material balance **Formula:** sg_avg = (sg_sp * rsp + sg_st * rst) / (rsp + rst) Returns weighted average gas SG (dimensionless, air=1). Args: request: Separator and stock tank gas properties Returns: Dictionary with weighted average SG and breakdown """ sg_avg = oil.sgg_wt_avg( sg_sp=request.sg_sp, rsp=request.rsp, sg_st=request.sg_st, rst=request.rst ) return { "weighted_average_sg": float(sg_avg), "separator_contribution": float(request.sg_sp * request.rsp / (request.rsp + request.rst)), "stock_tank_contribution": float(request.sg_st * request.rst / (request.rsp + request.rst)), "total_gor_scf_stb": float(request.rsp + request.rst), "method": "Weighted average by GOR", "units": "dimensionless (air=1)", "inputs": request.model_dump(), }
  • Pydantic model defining the input schema and validation for the weighted_average_gas_sg tool.
    class WeightedAverageGasSGRequest(BaseModel): """Request model for weighted average gas SG calculation.""" sg_sp: float = Field(..., gt=0, description="Separator gas specific gravity") rsp: float = Field(..., ge=0, description="Separator GOR (scf/stb)") sg_st: float = Field(..., gt=0, description="Stock tank gas specific gravity") rst: float = Field(..., ge=0, description="Stock tank GOR (scf/stb)")
  • Registration of oil tools, including weighted_average_gas_sg, via the register_oil_tools(mcp) call in the main MCP server setup.
    from .tools.oil_tools import register_oil_tools from .tools.gas_tools import register_gas_tools from .tools.inflow_tools import register_inflow_tools from .tools.simtools_tools import register_simtools_tools from .tools.brine_tools import register_brine_tools from .tools.layer_tools import register_layer_tools from .tools.library_tools import register_library_tools register_oil_tools(mcp)

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