Skip to main content
Glama
gabrielserrao

pyResToolbox MCP Server

oil_density

Calculate oil density at reservoir conditions for gradient calculations, well pressure analysis, and material balance using PVT properties.

Instructions

Calculate oil density (ρo) at reservoir conditions.

CRITICAL PVT PROPERTY - Computes oil density from PVT properties using mass balance approach. Essential for gradient calculations, well pressure analysis, and material balance calculations.

Parameters:

  • p (float or list, required): Pressure(s) in psia. Must be > 0. Can be scalar or array. Example: 3000.0.

  • api (float, required): Oil API gravity in degrees. Valid: 0-100. Example: 35.0.

  • degf (float, required): Reservoir temperature in °F. Valid: -460 to 1000. Example: 180.0.

  • rs (float or list, required): Solution GOR at pressure p in scf/stb. Must match p shape. Example: 600.0 or [400, 600, 800].

  • sg_g (float, required): Gas specific gravity (air=1). Valid: 0-3. Typical: 0.6-1.2. Example: 0.75.

  • bo (float or list, required): Oil formation volume factor at pressure p in rb/stb. Must match p shape. Calculate using oil_formation_volume_factor tool first. Example: 1.25 or [1.15, 1.25, 1.30].

Calculation Method: Density = (Stock tank oil mass + Dissolved gas mass) / Reservoir volume ρo = (sg_o × 62.372 + 0.01357 × Rs × sg_g) / Bo

Where:

  • sg_o = oil specific gravity (calculated from API)

  • 62.372 = water density at standard conditions (lb/cuft)

  • 0.01357 = gas density conversion factor

Typical Ranges:

  • Light oils: 40-50 lb/cuft

  • Medium oils: 50-55 lb/cuft

  • Heavy oils: 55-65 lb/cuft

Returns: Dictionary with:

  • value (float or list): Density in lb/cuft (matches input p shape)

  • method (str): "Standard"

  • units (str): "lb/cuft"

  • inputs (dict): Echo of input parameters

Common Mistakes:

  • Using stock tank density instead of reservoir density

  • Not providing matching rs and bo arrays

  • Using wrong bo value (must be at same pressure as p)

  • Confusing density (mass/volume) with specific gravity (dimensionless)

Example Usage:

{
    "p": 3000.0,
    "api": 35.0,
    "degf": 180.0,
    "rs": 600.0,
    "sg_g": 0.75,
    "bo": 1.25
}

Result: Density ≈ 48-52 lb/cuft for typical medium gravity oil.

Note: Always calculate Bo first using oil_formation_volume_factor tool, then use matching rs and bo values for accurate density calculation.

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 fully discloses behavioral traits. It explains the calculation method, typical ranges, return format, and critical notes like parameter matching requirements. It adds context on prerequisites (calculating Bo first) and validation rules (e.g., p > 0), which are not in the schema.

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, Calculation Method, Returns, etc.), but it is lengthy. Every sentence earns its place by providing essential information, though it could be more front-loaded; the critical purpose is stated early, but detailed sections follow, which is acceptable given the complexity.

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 (6 parameters, no annotations, 0% schema coverage, but with an output schema), the description is highly complete. It covers purpose, usage, parameters, method, returns, examples, and common mistakes. The output schema exists, so the description appropriately focuses on input semantics and behavioral context without needing to explain return values in detail.

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?

Schema description coverage is 0%, so the description compensates fully. Each parameter is detailed with meaning, units, valid ranges, examples, and constraints (e.g., 'Must match p shape'). It explains relationships between parameters (e.g., rs and bo must match p) and provides the underlying formula, adding significant value beyond the bare schema.

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 oil density at reservoir conditions using a mass balance approach, specifying it's for PVT properties. It distinguishes from siblings like 'gas_density' and 'oil_formation_volume_factor' by focusing specifically on oil density calculation, not gas properties or volume factors.

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?

Explicit guidance is provided: 'Always calculate Bo first using oil_formation_volume_factor tool, then use matching rs and bo values.' It also lists common mistakes to avoid, such as using stock tank density instead of reservoir density, which helps differentiate when to use this tool versus alternatives.

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