Skip to main content
Glama
gabrielserrao

pyResToolbox MCP Server

validate_gas_gravities

Validate gas gravity consistency and calculate missing values using separator and stock tank GOR data to ensure PVT data quality.

Instructions

Validate and impute missing gas gravities.

DATA VALIDATION TOOL - Checks consistency of gas gravities and calculates missing values when one is unknown.

Logic:

  • If sg_g provided: Calculate sg_sp from sg_g

  • If sg_sp provided: Calculate sg_g from sg_sp

  • If both provided: Validate consistency

Use Cases:

  • QC PVT data before analysis

  • Fill gaps in incomplete data

  • Validate separator gas measurements

Returns tuple of (sg_g, sg_sp) with calculated/validated values.

Args: request: Available gas gravities and GORs

Returns: Dictionary with validated/calculated gas gravities

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requestYes

Implementation Reference

  • The @mcp.tool()-decorated handler function that implements the validate_gas_gravities tool logic by calling oil.check_sgs to validate and compute gas specific gravities.
    @mcp.tool() def validate_gas_gravities(request: CheckGasSGsRequest) -> dict: """Validate and impute missing gas gravities. **DATA VALIDATION TOOL** - Checks consistency of gas gravities and calculates missing values when one is unknown. **Logic:** - If sg_g provided: Calculate sg_sp from sg_g - If sg_sp provided: Calculate sg_g from sg_sp - If both provided: Validate consistency **Use Cases:** - QC PVT data before analysis - Fill gaps in incomplete data - Validate separator gas measurements Returns tuple of (sg_g, sg_sp) with calculated/validated values. Args: request: Available gas gravities and GORs Returns: Dictionary with validated/calculated gas gravities """ sg_g_out, sg_sp_out = oil.check_sgs( sg_g=request.sg_g if request.sg_g is not None else 0, sg_sp=request.sg_sp if request.sg_sp is not None else 0, rst=request.rst, rsp=request.rsp, sg_st=request.sg_st ) return { "sg_g_weighted_average": float(sg_g_out), "sg_sp_separator": float(sg_sp_out), "method": "Weighted average calculation", "units": "dimensionless (air=1)", "inputs": request.model_dump(), "note": "sg_g and sg_sp are now consistent and validated" }
  • Pydantic BaseModel defining the input schema (CheckGasSGsRequest) for the validate_gas_gravities tool, including optional gas gravities and required GORs.
    class CheckGasSGsRequest(BaseModel): """Request model for gas gravity validation/imputation.""" sg_g: Optional[float] = Field(None, description="Weighted average gas SG (optional)") sg_sp: Optional[float] = Field(None, description="Separator gas SG (optional)") rst: float = Field(..., ge=0, description="Stock tank GOR (scf/stb)") rsp: float = Field(..., ge=0, description="Separator GOR (scf/stb)") sg_st: float = Field(..., gt=0, description="Stock tank gas SG")
  • Server registration code that imports and calls register_oil_tools(mcp), which defines the nested validate_gas_gravities handler and registers it with the FastMCP server.
    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) register_gas_tools(mcp) register_inflow_tools(mcp) register_simtools_tools(mcp) register_brine_tools(mcp) register_layer_tools(mcp) register_library_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