Skip to main content
Glama
rjenks
by rjenks

build_calculate_derived_stats

Calculate PF2e character derived stats: AC, saves, Perception, skill totals, HP, class DC, spell DC/attack. Handles proficiency stacking, worn armor, and potency runes to avoid math errors.

Instructions

Deterministic PF2e math: AC, saves, Perception, skill totals, HP, class DC, and spell DC/attack per casting tradition the character has trained. Never left to model arithmetic -- proficiency stacking (untrained = ability mod only, no level) is easy to get wrong.

AC uses the character's worn armor (Pathbuilder's `armor` list) if
present, else the unarmored baseline, and includes the armor's potency
rune if any. Does not yet include a raised shield's bonus -- see
pf2e_math.armor_ac docstring.

HP's `attributes.ancestryhp`/`attributes.classhp` and AC's
`proficiencies.unarmored` fall back to a lookup against this project's
own ingested `ancestry_boosts`/`class_progression` data (via the
character's `ancestry`/`class` fields) when the caller doesn't supply
them explicitly -- previously a caller-side omission here silently
produced a plausible-looking-but-wrong result (confirmed live: HP
understated by ~90 points, AC by 12, for a real level-10 character
built without these three fields) rather than an error, since Python's
dict.get default masked the difference between "explicitly 0" and
"never set." The explicit-value case is preserved -- these fallbacks
only apply when the key is genuinely absent, not when it's present and
zero (e.g. a real Wizard's `classhp` isn't 0, but nothing in this
system produces a *correct* 0 for these three fields either, so
treating "key absent" as the signal to fall back is safe in practice).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
characterYes

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, the description carries full burden and delivers extensively. It discloses the deterministic nature, the AC calculation basis (armor vs unarmored, potency rune), and a deep explanation of fallback behavior for missing HP/AC fields, including a real-world example of silent wrong results. This goes far beyond typical transparency.

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 front-loaded with a clear statement, then logically organized into AC specifics and a detailed fallback explanation. It is longer than average, and the fallback paragraph is verbose, but every sentence carries important technical nuance. Not maximally concise, but not bloated either.

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

Completeness4/5

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

The output schema is present, so return values needn't be explained. The description covers major inputs, edge cases, and limitations. It does not list all required character fields (e.g., ability scores, level), but given the tool is clearly PF2e-specific and the schema is open, the provided field references give strong context. A small gap remains for a fully self-contained spec.

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?

The input schema is nearly empty (one generic object with additionalProperties). The description compensates by referencing concrete fields like 'armor', 'attributes.ancestryhp', 'attributes.classhp', 'proficiencies.unarmored', 'ancestry', and 'class', explaining their role and even the nuanced absent-vs-zero behavior. This gives an agent essential guidance for constructing a correct 'character' object.

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 first sentence clearly states the tool's scope: 'Deterministic PF2e math: AC, saves, Perception, skill totals, HP, class DC, and spell DC/attack per casting tradition...' This is a specific verb+resource+output list, and it distinguishes the tool from sibling build_* list/validate/render tools. No ambiguity about what it does.

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?

The description gives clear context (compute derived stats for a PF2e character) and explicitly notes a limitation: 'Does not yet include a raised shield's bonus'. This tells the agent when not to rely on it. However, it does not name alternative tools or explicitly say 'use this instead of manual arithmetic' in a way that contrasts with siblings. The context is clear but exclusions are minimal.

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/rjenks/pf2e-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server