Skip to main content
Glama

PortfolioFit

Calculate portfolio constraints

calculate_portfolio_constraints
Idempotent

Calculate explicit portfolio constraints deterministically from normalized holdings. Use this for arithmetic checks, not for interpreting natural-language mandates.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "holdings": "<holdings>",
      "constraints": "<constraints>",
      "idempotency_key": "<idempotency_key>"
    },
    "name": "calculate_portfolio_constraints"
  }
}

Input Schema

NameRequiredDescriptionDefault
holdingsYes
constraintsYes
analysis_nameNoOptional private grouping name. The same case-sensitive name, after trimming outer whitespace, reuses one group for this user. Omit it for an independent operation. Keep the name on retries; each calculation still needs its own idempotency_key.
base_currencyNoUSD
idempotency_keyYes
source_warningsNo
composition_scopeNounknown

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changed
    • addedInput schema / properties / analysis_name
      Added value: +{
      +  "anyOf": [
      +    {
      +      "maxLength": 255,
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Optional private grouping name. The same case-sensitive name, after trimming outer whitespace, reuses one group for this user. Omit it for an independent operation. Keep the name on retries; each calculation still needs its own idempotency_key.",
      +  "title": "Analysis Name"
      +}
    • removedOutput schema / $defs / CapabilityLimitExceededOutput
      Removed value: -{
      -  "additionalProperties": false,
      -  "properties": {
      -    "capability": {
      -      "title": "Capability",
      -      "type": "string"
      -    },
      -    "code": {
      -      "const": "capability_limit_exceeded",
      -      "title": "Code",
      -      "type": "string"
      -    },
      -    "message": {
      -      "title": "Message",
      -      "type": "string"
      -    },
      -    "plan": {
      -      "title": "Plan",
      -      "type": "string"
      -    },
      -    "resolution_paths": {
      -      "items": {
      -        "$ref": "#/$defs/CapabilityLimitResolutionPath"
      -      },
      -      "minItems": 1,
      -      "title": "Resolution Paths",
      -      "type": "array"
      -    },
      -    "retryable_now": {
      -      "const": false,
      -      "default": false,
      -      "title": "Retryable Now",
      -      "type": "boolean"
      -    },
      -    "same_idempotency_key_reusable": {
      -      "const": true,
      -      "default": true,
      -      "title": "Same Idempotency Key Reusable",
      -      "type": "boolean"
      -    },
      -    "status": {
      -      "const": "quota_exceeded",
      -      "title": "Status",
      -      "type": "string"
      -    },
      -    "usage": {
      -      "$ref": "#/$defs/CapabilityLimitUsage"
      -    }
      -  },
      -  "required": [
      -    "code",
      -    "status",
      -    "message",
      -    "capability",
      -    "plan",
      -    "usage",
      -    "resolution_paths"
      -  ],
      -  "title": "CapabilityLimitExceededOutput",
      -  "type": "object"
      -}
    • addedOutput schema / $defs / GroupedConstraintsOutput
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "analysis_id": {
      +      "title": "Analysis Id",
      +      "type": "string"
      +    },
      +    "analysis_name": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "title": "Analysis Name"
      +    },
      +    "analysis_url": {
      +      "title": "Analysis Url",
      +      "type": "string"
      +    },
      +    "capability": {
      +      "const": "portfolio_constraints.v1",
      +      "title": "Capability",
      +      "type": "string"
      +    },
      +    "meta": {
      +      "$ref": "#/$defs/InvocationMeta"
      +    },
      +    "results": {
      +      "items": {
      +        "$ref": "#/$defs/ConstraintResult"
      +      },
      +      "title": "Results",
      +      "type": "array"
      +    },
      +    "status": {
      +      "enum": [
      +        "compliant",
      +        "non_compliant",
      +        "insufficient_evidence"
      +      ],
      +      "title": "Status",
      +      "type": "string"
      +    },
      +    "warnings": {
      +      "items": {
      +        "type": "string"
      +      },
      +      "title": "Warnings",
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "analysis_id",
      +    "analysis_name",
      +    "analysis_url",
      +    "capability",
      +    "status",
      +    "meta"
      +  ],
      +  "title": "GroupedConstraintsOutput",
      +  "type": "object"
      +}
    • addedOutput schema / $defs / GroupedLimitOutput
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "analysis_id": {
      +      "title": "Analysis Id",
      +      "type": "string"
      +    },
      +    "analysis_name": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "title": "Analysis Name"
      +    },
      +    "analysis_url": {
      +      "title": "Analysis Url",
      +      "type": "string"
      +    },
      +    "capability": {
      +      "title": "Capability",
      +      "type": "string"
      +    },
      +    "code": {
      +      "const": "capability_limit_exceeded",
      +      "title": "Code",
      +      "type": "string"
      +    },
      +    "message": {
      +      "title": "Message",
      +      "type": "string"
      +    },
      +    "plan": {
      +      "title": "Plan",
      +      "type": "string"
      +    },
      +    "resolution_paths": {
      +      "items": {
      +        "$ref": "#/$defs/CapabilityLimitResolutionPath"
      +      },
      +      "minItems": 1,
      +      "title": "Resolution Paths",
      +      "type": "array"
      +    },
      +    "retryable_now": {
      +      "const": false,
      +      "default": false,
      +      "title": "Retryable Now",
      +      "type": "boolean"
      +    },
      +    "same_idempotency_key_reusable": {
      +      "const": true,
      +      "default": true,
      +      "title": "Same Idempotency Key Reusable",
      +      "type": "boolean"
      +    },
      +    "status": {
      +      "const": "quota_exceeded",
      +      "title": "Status",
      +      "type": "string"
      +    },
      +    "usage": {
      +      "$ref": "#/$defs/CapabilityLimitUsage"
      +    }
      +  },
      +  "required": [
      +    "analysis_id",
      +    "analysis_name",
      +    "analysis_url",
      +    "code",
      +    "status",
      +    "message",
      +    "capability",
      +    "plan",
      +    "usage",
      +    "resolution_paths"
      +  ],
      +  "title": "GroupedLimitOutput",
      +  "type": "object"
      +}
    • removedOutput schema / $defs / PortfolioConstraintsOutput
      Removed value: -{
      -  "additionalProperties": false,
      -  "properties": {
      -    "capability": {
      -      "const": "portfolio_constraints.v1",
      -      "title": "Capability",
      -      "type": "string"
      -    },
      -    "meta": {
      -      "$ref": "#/$defs/InvocationMeta"
      -    },
      -    "results": {
      -      "items": {
      -        "$ref": "#/$defs/ConstraintResult"
      -      },
      -      "title": "Results",
      -      "type": "array"
      -    },
      -    "status": {
      -      "enum": [
      -        "compliant",
      -        "non_compliant",
      -        "insufficient_evidence"
      -      ],
      -      "title": "Status",
      -      "type": "string"
      -    },
      -    "warnings": {
      -      "items": {
      -        "type": "string"
      -      },
      -      "title": "Warnings",
      -      "type": "array"
      -    }
      -  },
      -  "required": [
      -    "capability",
      -    "status",
      -    "meta"
      -  ],
      -  "title": "PortfolioConstraintsOutput",
      -  "type": "object"
      -}
    • changedOutput schema / anyOf
      Previous value: -[
      -  {
      -    "$ref": "#/$defs/PortfolioConstraintsOutput"
      -  },
      -  {
      -    "$ref": "#/$defs/CapabilityLimitExceededOutput"
      -  }
      -]New value: +[
      +  {
      +    "$ref": "#/$defs/GroupedConstraintsOutput"
      +  },
      +  {
      +    "$ref": "#/$defs/GroupedLimitOutput"
      +  }
      +]
    • changedOutput schema / title
      Previous value: -"PortfolioConstraintsToolOutput"New value: +"GroupedConstraintsToolOutput"
  2. Changed1 schema field changed
    • addedInput schema / $defs / AlignmentHolding / properties / weight / description
      Added value: +"Portfolio weight. Prefer a decimal share such as 0.24 for 24%. Percentage-point inputs such as 24 are also accepted and normalized when the supplied holdings use that convention."
  3. First observed

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare destructiveHint=false, idempotentHint=true and openWorldHint=false, so the safety and retry profile is covered structurally. The description adds only the determinism/normalization context; it says nothing about what the call persists, how analysis_name grouping behaves, or that idempotency_key must be unique per calculation, all of which the agent needs. With annotations carrying most of the load, a 3 is appropriate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, zero filler, with the usage boundary front-loaded alongside the purpose. Nothing to cut.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need not be described, and annotations cover the safety profile. However, for a 7-parameter tool with a low-coverage schema and persistence semantics (idempotency_key, analysis_name grouping), the description leaves too much unexplained to be considered complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 14% across 7 parameters (only analysis_name and weight carry prose), so the description must compensate and does not — it mentions no parameter at all. The nested $defs enums and bounds are self-documenting, but holdings, constraints, idempotency_key and composition_scope receive no explanation beyond their names.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ("calculate portfolio constraints") and adds a scope qualifier ("deterministically from normalized holdings"). The closing clause distinguishes it from natural-language mandate tools, which differentiates it from siblings like evaluate_portfolio_alignment, though the sibling is not named.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

"Use this for arithmetic checks, not for interpreting natural-language mandates" gives an explicit when-to-use and when-not-to-use. It falls short of 5 because it never names the alternative tool an agent should pick for mandate interpretation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources