> For the complete documentation index, see [llms.txt](https://api-docs.hengelending.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api-docs.hengelending.com/mcp/tool-reference/reporting.md). Agents can also search and read this documentation through its [MCP server](https://api-docs.hengelending.com/~gitbook/mcp).

# Reporting

Pipeline, milestone and revenue reports, and queries across loans.

{% hint style="info" %}
Generated from the MCP server's code. Do not edit this page in GitBook: changes are overwritten on the next sync.
{% endhint %}

## conditions\_by\_outcome

Correlate underwriting condition categories with loan outcomes. For loans in terminal statuses (closed/funded vs. denied/withdrawn/cancelled/suspended/archived), returns per-category counts and the share associated with non-closing loans (FailedShare). Answers "which underwriting conditions are most indicative of a loan that won't close". Descriptive association only, not causation. Every filter narrows the loans considered EXCEPT loanTypes: this report reads SQL, where the only type-ish column is mortgageLoanType (product-class codes, not loan types), so decoded names like "Conventional" match nothing and silently return an empty report rather than an error. Results are always scoped to loans you can access.

**Who can call it:** Admin, Processor, DualLicensedAgent, ConciergeKey, Agent, CompanyAdmin

**Reads or writes:** reads only

| Input                     | Type                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `filter`                  | object                 | Loan filter applied before correlating conditions to outcomes. All fields optional; results are always scoped to loans you can access.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `filter.searchText`       | string                 | Free-text match (case-insensitive) against the loan number and borrower first name, last name, and email. Whitespace-separated tokens must all match.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `filter.statuses`         | array of string        | Loan statuses to include (exact MLM status names, OR'd together), e.g. "Loan Funded", "Loan Closed", "Loan Underwriting", "Loan Processing", "Loan Clear To Close", "Loan Denied", "Loan Withdrawn". Call get\_loan\_reporting\_metadata for the full valid list. Note: "Loan Closed" and "Loan Clear To Close" are different statuses. IMPORTANT: this matches each loan's CURRENT status only — loans do not stay at "Loan Closed"/"Loan Funded" but move on to Sold/Purchased/Archived, so do NOT use this to count loans that closed/funded in a period; use report\_loan\_milestones (historical status crossings) for that.                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `filter.loanTypes`        | array of string        | Loan types to include (exact decoded names), e.g. "Conventional", "FHA", "VA", "USDA/Rural Housing", "Other". Call get\_loan\_reporting\_metadata for valid values. Matches the loan's `loanType` field (the decoded MLM sLT name) — NOT `mortgageLoanType`, which is a different MLM field (sMortgageLoanT) holding the loan's product class as a raw code (0=Government\_FHA\_VA\_RHS, 1=PrimeConforming, 2=PrimeNonConforming, 3=Other1To4UnitResidential, 4=ClosedEndSecond, 5=FundedHELOC, 6=Construction) and cannot express this enum: its code 0 covers FHA, VA and RHS together. CAUTION: loanType is unset on most loans, so this filter returns a small subset and a loan with no loanType is unknown, not Conventional; a few loans also carry the unnormalized value "CONV" that a filter on "Conventional" misses. Honored on report\_loans and loan\_pipeline\_report; on report\_loan\_milestones and conditions\_by\_outcome it currently matches the raw mortgageLoanType column instead, so these names silently return nothing there — use report\_loans for loan-type breakdowns. |
| `filter.purposes`         | array of string        | Loan purposes to include (exact names), e.g. "Purchase", "Refinance", "Refinance Cashout". Call get\_loan\_reporting\_metadata for valid values.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `filter.statusDateFrom`   | string (date-time)     | Include loans whose CURRENT status was set on/after this date (ISO 8601). This is when the loan last changed status — NOT when it closed/funded. Do NOT use this for "closed/funded in period X" questions (a closed loan's current status is usually a later one such as Sold or Archived); use report\_loan\_milestones for those.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `filter.statusDateTo`     | string (date-time)     | Include loans whose CURRENT status was set on/before this date (ISO 8601). Use end-of-day to include a full day. Same caveat as statusDateFrom: not suitable for "closed/funded in period X" — use report\_loan\_milestones.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.closingDateFrom`  | string (date-time)     | Include loans with a closing date on/after this date (ISO 8601). CAUTION: closingDate is sparsely populated (it is an estimated closing date, unset on most loans), so a 0-loan result usually means the field is missing, not that nothing closed — use report\_loan\_milestones for closed/funded-in-period questions.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `filter.closingDateTo`    | string (date-time)     | Include loans with a closing date on/before this date (ISO 8601). Same caution as closingDateFrom: sparsely populated; a 0-loan result usually means missing data.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `filter.updatedFrom`      | string (date-time)     | Include loans last updated on/after this date (ISO 8601).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `filter.updatedTo`        | string (date-time)     | Include loans last updated on/before this date (ISO 8601).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `filter.createdFrom`      | string (date-time)     | Include loans created (the application started in Henge) on/after this date (ISO 8601).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `filter.createdTo`        | string (date-time)     | Include loans created on/before this date (ISO 8601). Use end-of-day to include a full day.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `filter.loanOfficerIds`   | array of string (uuid) | Restrict to these loan-officer user IDs (GUIDs). Always intersected with your access scope — you can narrow but never widen what you can see. Obtain IDs from search\_users.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.referringAgentId` | string (uuid)          | Restrict to loans referred by this user ID (GUID).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `filter.processorId`      | string (uuid)          | Restrict to loans handled by this processor user ID (GUID).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `filter.loanAmountMin`    | number                 | Minimum loan amount in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `filter.loanAmountMax`    | number                 | Maximum loan amount in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `filter.commissionMin`    | number                 | Minimum locked compensation (commission) in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.commissionMax`    | number                 | Maximum locked compensation (commission) in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.propertyState`    | string                 | Two-letter subject-property state code, e.g. "FL".                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `filter.includeDeleted`   | boolean                | Include soft-deleted loans (default false). Deleted loans are hidden from the Henge UI and from every other report, so leaving this off is what makes a count match what the user sees on screen. Set true only to investigate a specific loan someone deleted, never to "find more loans".                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `filter.excludeTestData`  | boolean                | Leave test loans out even when you are a test user (default false). Test loans (a test user's loans, or a loan flagged IsTest) are already left out for every other caller; a test user sees them unless this is set. Set it for any report meant for the business, so it counts what everyone else sees.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `filter.excludeLosOnly`   | boolean                | Leave out loans that exist only in MLM (default false). These are loans originated in MLM and never in Henge, mostly from 2024: real closed, archived and withdrawn loans the retired data warehouse used to count, so they are included by default and the totals match what MLM holds. They have no record in the Henge app (no borrower portal, tasks or documents) and their loan officer may not be a Henge user. Set this to count only loans that went through Henge.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

## export\_agent\_productivity\_data

Export the two data sheets of the Agent Productivity Report workbook: loan apps (one row per loan application, the workbook's Data\_Dump\_Internal) and milestone events (one row per loan per MLM milestone, Data\_Dump\_Meridian, with Power BI's event names Opened / Pre-Approved / Rate Locked / Funded and the rest, compensation, investor-lock profit, Profit/Loss and branch channel). Returns each dataset's row count and a download link; the rows are too many to return here. Download each link with GET, sending the token from get\_api\_access\_token as the Bearer header (it expires in about 15 minutes). No test loans and no deleted loans; archived loans are included. A loan with no referring agent has ReferredByFullName " ", which the workbook's formulas rely on. Admin exports every company, or one with companyId; a CompanyAdmin always gets their own company only.

**Who can call it:** Admin, CompanyAdmin

**Reads or writes:** reads only

| Input       | Type          | Description                                                                                                                       |
| ----------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `companyId` | string (uuid) | Admin only: export one company's loans. Omit for every company. A CompanyAdmin always gets their own company and this is ignored. |

## get\_loan\_query\_fields

Return the whitelist of fields available to query\_loans: each field's key, type, scope (Loan/Borrower/User), whether it can be selected (vs. filter-only) or only selected (selectOnly: computed after the query, such as companyName and latestMilestone), whether it requires elevated (admin/processor/concierge) access, and — where the key alone is misleading — a description of what the field actually holds. Call this before building a query\_loans request, and READ THE DESCRIPTIONS: `loanType` and `mortgageLoanType` are two different fields, and the one that answers loan-type questions is `loanType` (the decoded Conventional/FHA/VA/USDA name). `mortgageLoanType` is a different MLM field holding the loan's product class as a raw code (0=Government\_FHA\_VA\_RHS, 1=PrimeConforming, 2=PrimeNonConforming, 3=Other1To4UnitResidential, 4=ClosedEndSecond, 5=FundedHELOC, 6=Construction) — the field to use for conforming-vs-jumbo, second-lien or HELOC questions, and the wrong field for loan type.

**Who can call it:** Admin, Processor, DualLicensedAgent, ConciergeKey, Agent, CompanyAdmin

**Reads or writes:** reads only

Takes no inputs.

## get\_loan\_reporting\_metadata

Return the valid vocabulary for the loan reporting tools: loan statuses, loan types, purposes, group-by dimensions, metric functions, metric fields, date fields, order-by options, plus the Northstar stages and milestone granularities, and a notes list carrying the caveats those value lists do not show on their own. Call this first if unsure which exact values the reporting tools accept. The returned loan types are values of the `loanType` field, NOT of the separate `mortgageLoanType` field (the product class — its code table is returned as mortgageLoanTypeCodes); see the notes.

**Who can call it:** Admin, Processor, DualLicensedAgent, ConciergeKey, Agent, CompanyAdmin

**Reads or writes:** reads only

Takes no inputs.

## loan\_pipeline\_report

CURRENT pipeline snapshot: how many loans are NOW at each macro stage (ordered Lead → Application → Processing → Underwriting → Approved → Clear to Close → Docs → Funded, terminal stages last) with total amount, plus a monthly trend over the look-back window. Answers "what is in the pipeline now" and "where are loans piling up / dropping off". For how many loans CROSSED each stage over a period (funnel flow, not a current snapshot) use report\_loan\_milestones. Results are always scoped to loans you can access.

**Who can call it:** Admin, Processor, DualLicensedAgent, ConciergeKey, Agent, CompanyAdmin

**Reads or writes:** reads only

| Input                     | Type                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `filter`                  | object                 | Loan filter applied to the pipeline. All fields optional; results are always scoped to loans you can access.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.searchText`       | string                 | Free-text match (case-insensitive) against the loan number and borrower first name, last name, and email. Whitespace-separated tokens must all match.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `filter.statuses`         | array of string        | Loan statuses to include (exact MLM status names, OR'd together), e.g. "Loan Funded", "Loan Closed", "Loan Underwriting", "Loan Processing", "Loan Clear To Close", "Loan Denied", "Loan Withdrawn". Call get\_loan\_reporting\_metadata for the full valid list. Note: "Loan Closed" and "Loan Clear To Close" are different statuses. IMPORTANT: this matches each loan's CURRENT status only — loans do not stay at "Loan Closed"/"Loan Funded" but move on to Sold/Purchased/Archived, so do NOT use this to count loans that closed/funded in a period; use report\_loan\_milestones (historical status crossings) for that.                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `filter.loanTypes`        | array of string        | Loan types to include (exact decoded names), e.g. "Conventional", "FHA", "VA", "USDA/Rural Housing", "Other". Call get\_loan\_reporting\_metadata for valid values. Matches the loan's `loanType` field (the decoded MLM sLT name) — NOT `mortgageLoanType`, which is a different MLM field (sMortgageLoanT) holding the loan's product class as a raw code (0=Government\_FHA\_VA\_RHS, 1=PrimeConforming, 2=PrimeNonConforming, 3=Other1To4UnitResidential, 4=ClosedEndSecond, 5=FundedHELOC, 6=Construction) and cannot express this enum: its code 0 covers FHA, VA and RHS together. CAUTION: loanType is unset on most loans, so this filter returns a small subset and a loan with no loanType is unknown, not Conventional; a few loans also carry the unnormalized value "CONV" that a filter on "Conventional" misses. Honored on report\_loans and loan\_pipeline\_report; on report\_loan\_milestones and conditions\_by\_outcome it currently matches the raw mortgageLoanType column instead, so these names silently return nothing there — use report\_loans for loan-type breakdowns. |
| `filter.purposes`         | array of string        | Loan purposes to include (exact names), e.g. "Purchase", "Refinance", "Refinance Cashout". Call get\_loan\_reporting\_metadata for valid values.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `filter.statusDateFrom`   | string (date-time)     | Include loans whose CURRENT status was set on/after this date (ISO 8601). This is when the loan last changed status — NOT when it closed/funded. Do NOT use this for "closed/funded in period X" questions (a closed loan's current status is usually a later one such as Sold or Archived); use report\_loan\_milestones for those.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `filter.statusDateTo`     | string (date-time)     | Include loans whose CURRENT status was set on/before this date (ISO 8601). Use end-of-day to include a full day. Same caveat as statusDateFrom: not suitable for "closed/funded in period X" — use report\_loan\_milestones.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.closingDateFrom`  | string (date-time)     | Include loans with a closing date on/after this date (ISO 8601). CAUTION: closingDate is sparsely populated (it is an estimated closing date, unset on most loans), so a 0-loan result usually means the field is missing, not that nothing closed — use report\_loan\_milestones for closed/funded-in-period questions.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `filter.closingDateTo`    | string (date-time)     | Include loans with a closing date on/before this date (ISO 8601). Same caution as closingDateFrom: sparsely populated; a 0-loan result usually means missing data.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `filter.updatedFrom`      | string (date-time)     | Include loans last updated on/after this date (ISO 8601).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `filter.updatedTo`        | string (date-time)     | Include loans last updated on/before this date (ISO 8601).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `filter.createdFrom`      | string (date-time)     | Include loans created (the application started in Henge) on/after this date (ISO 8601).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `filter.createdTo`        | string (date-time)     | Include loans created on/before this date (ISO 8601). Use end-of-day to include a full day.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `filter.loanOfficerIds`   | array of string (uuid) | Restrict to these loan-officer user IDs (GUIDs). Always intersected with your access scope — you can narrow but never widen what you can see. Obtain IDs from search\_users.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.referringAgentId` | string (uuid)          | Restrict to loans referred by this user ID (GUID).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `filter.processorId`      | string (uuid)          | Restrict to loans handled by this processor user ID (GUID).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `filter.loanAmountMin`    | number                 | Minimum loan amount in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `filter.loanAmountMax`    | number                 | Maximum loan amount in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `filter.commissionMin`    | number                 | Minimum locked compensation (commission) in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.commissionMax`    | number                 | Maximum locked compensation (commission) in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.propertyState`    | string                 | Two-letter subject-property state code, e.g. "FL".                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `filter.includeDeleted`   | boolean                | Include soft-deleted loans (default false). Deleted loans are hidden from the Henge UI and from every other report, so leaving this off is what makes a count match what the user sees on screen. Set true only to investigate a specific loan someone deleted, never to "find more loans".                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `filter.excludeTestData`  | boolean                | Leave test loans out even when you are a test user (default false). Test loans (a test user's loans, or a loan flagged IsTest) are already left out for every other caller; a test user sees them unless this is set. Set it for any report meant for the business, so it counts what everyone else sees.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `filter.excludeLosOnly`   | boolean                | Leave out loans that exist only in MLM (default false). These are loans originated in MLM and never in Henge, mostly from 2024: real closed, archived and withdrawn loans the retired data warehouse used to count, so they are included by default and the totals match what MLM holds. They have no record in the Henge app (no borrower portal, tasks or documents) and their loan officer may not be a Henge user. Set this to count only loans that went through Henge.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `lookbackMonths`          | integer                | Number of months of monthly trend to include (default 3).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

## query\_loans

Run a custom filtered query returning ONE ROW PER LOAN: supply WHERE conditions (whitelisted field + operator + value) and optionally which fields to return. This is NOT raw SQL — you choose from a fixed field whitelist (call get\_loan\_query\_fields) and values are bound as parameters, so it is injection-safe and read-only. Use when the fixed filters on search\_loans aren't enough; for aggregated counts/sums use report\_loans. Field keys are not all self-explanatory — notably, loan type is `loanType`, while the similarly named `mortgageLoanType` holds the product class as a raw code (conforming / jumbo / second / HELOC / construction; decode table in get\_loan\_reporting\_metadata) — so consult the descriptions get\_loan\_query\_fields returns instead of picking a key by its name. Selecting `mortgageLoanType` also returns a derived `mortgageLoanTypeName` column with its code decoded; filter on the raw code, read the name. Results are always scoped to loans you can access.

**Who can call it:** Admin, Processor, DualLicensedAgent, ConciergeKey, Agent, CompanyAdmin

**Reads or writes:** reads only

| Input                   | Type            | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ----------------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `conditions`            | array of object | WHERE conditions, all AND'd together. This is NOT raw SQL — each condition is a whitelisted field + operator + parameterized value. Results are always additionally scoped to loans you can access.                                                                                                                                                                                                                                                                          |
| `conditions[].field`    | string          | Whitelisted field key (call get\_loan\_query\_fields for the list), e.g. "status", "loanAmount", "borrowerLastName", "clientId".                                                                                                                                                                                                                                                                                                                                             |
| `conditions[].operator` | string          | One of: Eq, Ne, Gt, Gte, Lt, Lte, Contains, StartsWith, In. Contains/StartsWith require a text field; Gt/Gte/Lt/Lte require number/date; In uses 'values'. One of `Eq`, `Ne`, `Gt`, `Gte`, `Lt`, `Lte`, `Contains`, `StartsWith`, `In`.                                                                                                                                                                                                                                      |
| `conditions[].value`    | string          | Comparison value (string form; numbers/dates/guids are parsed and bound as parameters). Used by all operators except In.                                                                                                                                                                                                                                                                                                                                                     |
| `conditions[].values`   | array of string | Values for the In operator.                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `select`                | array of string | Field keys to return per loan (default: a standard loan summary). Borrower fields are filter-only, except primaryBorrowerName; it and the user-name fields require an admin/processor/concierge role. primaryBorrowerName, companyName, latestMilestone and latestMilestoneDate are computed after the query: selectable, but not usable in conditions or orderBy.                                                                                                           |
| `top`                   | integer         | Max loans to return (1-50, default 20).                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `skip`                  | integer         | Number of loans to skip for paging (default 0).                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `orderBy`               | string          | Field key to sort by (default "updatedDate").                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `orderDescending`       | boolean         | Sort descending (default true).                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `includeDeleted`        | boolean         | Include soft-deleted loans (default false). Deleted loans are hidden from the Henge UI and from every other report, so leaving this off is what makes a count match what the user sees on screen. Set true only to investigate a specific loan someone deleted, never to "find more loans".                                                                                                                                                                                  |
| `excludeTestData`       | boolean         | Leave test loans out even when you are a test user (default false). Test loans (a test user's loans, or a loan flagged IsTest) are already left out for every other caller; a test user sees them unless this is set. Set it for any report meant for the business, so it counts what everyone else sees.                                                                                                                                                                    |
| `excludeLosOnly`        | boolean         | Leave out loans that exist only in MLM (default false). These are loans originated in MLM and never in Henge, mostly from 2024: real closed, archived and withdrawn loans the retired data warehouse used to count, so they are included by default and the totals match what MLM holds. They have no record in the Henge app (no borrower portal, tasks or documents) and their loan officer may not be a Henge user. Set this to count only loans that went through Henge. |

## report\_loan\_milestones

Funnel FLOW over time: counts distinct loans that REACHED each milestone per week or month — not where they sit now (for the current snapshot use loan\_pipeline\_report). THE tool for "how many loans / how much volume did we close (fund) last month/quarter/year" and any "loans that went through status X in timeframe Y" question: it reads persisted historical status crossings, so it still counts loans whose current status has since moved on (Sold/Purchased/Archived). Grouped into the ordered Northstar stages (1. Opened, 2. Pre-Approved, 3. Rate Locked, 4. Approved, 5. Closed & Funded), or by raw milestone with groupByNorthstar:false. Built from persisted LOS status history, so only loans synced to the LOS are covered. A loan counts ONCE per stage, in the period of its earliest crossing within the look-back window, so the periods sum to unique loans; a consequence is that changing the look-back can move which period a loan falls in. For an exact window over crossing dates (e.g. the last 60 days, or days 61-120) pass milestoneDateFrom/milestoneDateTo instead of lookback; the response echoes the window as from/to. Every filter you pass (loanOfficerIds, statuses, amounts, searchText, ...) narrows the loans counted — EXCEPT loanTypes: this report reads SQL, where the only type-ish column is mortgageLoanType (product-class codes, not loan types), so decoded names like "Conventional" match nothing and the report silently returns zero buckets. Do not read that as "no loans of that type" — use report\_loans for loan-type breakdowns. Statuses outside the 5 stages fall into "Other" and the stage mapping is provisional — pass groupByNorthstar:false to see the underlying milestones. Results are always scoped to loans you can access.

**Who can call it:** Admin, Processor, DualLicensedAgent, ConciergeKey, Agent, CompanyAdmin

**Reads or writes:** reads only

| Input                     | Type                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `filter`                  | object                 | Optional loan filter (same shape as report\_loans). Results are always scoped to loans you can access.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `filter.searchText`       | string                 | Free-text match (case-insensitive) against the loan number and borrower first name, last name, and email. Whitespace-separated tokens must all match.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `filter.statuses`         | array of string        | Loan statuses to include (exact MLM status names, OR'd together), e.g. "Loan Funded", "Loan Closed", "Loan Underwriting", "Loan Processing", "Loan Clear To Close", "Loan Denied", "Loan Withdrawn". Call get\_loan\_reporting\_metadata for the full valid list. Note: "Loan Closed" and "Loan Clear To Close" are different statuses. IMPORTANT: this matches each loan's CURRENT status only — loans do not stay at "Loan Closed"/"Loan Funded" but move on to Sold/Purchased/Archived, so do NOT use this to count loans that closed/funded in a period; use report\_loan\_milestones (historical status crossings) for that.                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `filter.loanTypes`        | array of string        | Loan types to include (exact decoded names), e.g. "Conventional", "FHA", "VA", "USDA/Rural Housing", "Other". Call get\_loan\_reporting\_metadata for valid values. Matches the loan's `loanType` field (the decoded MLM sLT name) — NOT `mortgageLoanType`, which is a different MLM field (sMortgageLoanT) holding the loan's product class as a raw code (0=Government\_FHA\_VA\_RHS, 1=PrimeConforming, 2=PrimeNonConforming, 3=Other1To4UnitResidential, 4=ClosedEndSecond, 5=FundedHELOC, 6=Construction) and cannot express this enum: its code 0 covers FHA, VA and RHS together. CAUTION: loanType is unset on most loans, so this filter returns a small subset and a loan with no loanType is unknown, not Conventional; a few loans also carry the unnormalized value "CONV" that a filter on "Conventional" misses. Honored on report\_loans and loan\_pipeline\_report; on report\_loan\_milestones and conditions\_by\_outcome it currently matches the raw mortgageLoanType column instead, so these names silently return nothing there — use report\_loans for loan-type breakdowns. |
| `filter.purposes`         | array of string        | Loan purposes to include (exact names), e.g. "Purchase", "Refinance", "Refinance Cashout". Call get\_loan\_reporting\_metadata for valid values.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `filter.statusDateFrom`   | string (date-time)     | Include loans whose CURRENT status was set on/after this date (ISO 8601). This is when the loan last changed status — NOT when it closed/funded. Do NOT use this for "closed/funded in period X" questions (a closed loan's current status is usually a later one such as Sold or Archived); use report\_loan\_milestones for those.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `filter.statusDateTo`     | string (date-time)     | Include loans whose CURRENT status was set on/before this date (ISO 8601). Use end-of-day to include a full day. Same caveat as statusDateFrom: not suitable for "closed/funded in period X" — use report\_loan\_milestones.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.closingDateFrom`  | string (date-time)     | Include loans with a closing date on/after this date (ISO 8601). CAUTION: closingDate is sparsely populated (it is an estimated closing date, unset on most loans), so a 0-loan result usually means the field is missing, not that nothing closed — use report\_loan\_milestones for closed/funded-in-period questions.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `filter.closingDateTo`    | string (date-time)     | Include loans with a closing date on/before this date (ISO 8601). Same caution as closingDateFrom: sparsely populated; a 0-loan result usually means missing data.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `filter.updatedFrom`      | string (date-time)     | Include loans last updated on/after this date (ISO 8601).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `filter.updatedTo`        | string (date-time)     | Include loans last updated on/before this date (ISO 8601).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `filter.createdFrom`      | string (date-time)     | Include loans created (the application started in Henge) on/after this date (ISO 8601).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `filter.createdTo`        | string (date-time)     | Include loans created on/before this date (ISO 8601). Use end-of-day to include a full day.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `filter.loanOfficerIds`   | array of string (uuid) | Restrict to these loan-officer user IDs (GUIDs). Always intersected with your access scope — you can narrow but never widen what you can see. Obtain IDs from search\_users.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.referringAgentId` | string (uuid)          | Restrict to loans referred by this user ID (GUID).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `filter.processorId`      | string (uuid)          | Restrict to loans handled by this processor user ID (GUID).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `filter.loanAmountMin`    | number                 | Minimum loan amount in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `filter.loanAmountMax`    | number                 | Maximum loan amount in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `filter.commissionMin`    | number                 | Minimum locked compensation (commission) in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.commissionMax`    | number                 | Maximum locked compensation (commission) in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.propertyState`    | string                 | Two-letter subject-property state code, e.g. "FL".                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `filter.includeDeleted`   | boolean                | Include soft-deleted loans (default false). Deleted loans are hidden from the Henge UI and from every other report, so leaving this off is what makes a count match what the user sees on screen. Set true only to investigate a specific loan someone deleted, never to "find more loans".                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `filter.excludeTestData`  | boolean                | Leave test loans out even when you are a test user (default false). Test loans (a test user's loans, or a loan flagged IsTest) are already left out for every other caller; a test user sees them unless this is set. Set it for any report meant for the business, so it counts what everyone else sees.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `filter.excludeLosOnly`   | boolean                | Leave out loans that exist only in MLM (default false). These are loans originated in MLM and never in Henge, mostly from 2024: real closed, archived and withdrawn loans the retired data warehouse used to count, so they are included by default and the totals match what MLM holds. They have no record in the Henge app (no borrower portal, tasks or documents) and their loan officer may not be a Henge user. Set this to count only loans that went through Henge.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `granularity`             | string                 | Time bucket: Week (ISO, Monday start) or Month. Default Month.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `lookback`                | integer                | How many buckets back from today to include (e.g. 4 = last 4 weeks or 4 months). Default 4.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `milestoneDateFrom`       | string (date)          | First day (yyyy-MM-dd, UTC, inclusive) of an explicit window over the dates loans CROSSED each milestone. When set it replaces the window lookback computes, so a window such as "the last 60 days" can be asked for directly; buckets keep the chosen granularity, so the first and last can be partial weeks or months. Not the same as filter.statusDateFrom, which narrows by each loan's CURRENT status date. Max 731 days.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `milestoneDateTo`         | string (date)          | Last day (yyyy-MM-dd, UTC, inclusive) of the explicit milestone window. Defaults to today; requires milestoneDateFrom.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `groupByNorthstar`        | boolean                | Group milestones into the ordered Northstar funnel stages (default true). False = group by raw milestone name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `excludeStages`           | array of string        | Northstar stage labels to exclude, e.g. \["Other","5. Closed & Funded"] to show only in-flight stages. Default none.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |

## report\_loans

Aggregate loans into buckets by a groupBy dimension (None, Status, LoanType, Purpose, LoanOfficer, ReferringAgent, Company, Day, Month, Quarter, Year), optionally crossed with up to two thenBy dimensions for one bucket per combination, and a metric (Count, Sum, Average, Min, Max over LoanAmount/LockedCompensation/EstimatedCompensation); each bucket returns count, inLosCount (loans that reached the LOS, i.e. have a loan number) and sum/average/min/max. A point-in-time aggregate by loans' CURRENT attributes — e.g. "loans by current status", "average loan amount". This tool CANNOT answer "how many loans / how much volume did we close (or fund) in period X": loans do not stay at a terminal status (Closed moves on to Sold/Purchased/Archived), so current-status filters undercount drastically — use report\_loan\_milestones (historical status crossings) for closed/funded/reached-stage-in-period questions. Known behaviors: Month/Quarter/Year grouping silently drops loans missing the chosen date field, and a bucket omits Sum/Average/Min when some of its loans lack a numeric value. For one row per loan use query\_loans. Results are always scoped to loans you can access.

**Who can call it:** Admin, Processor, DualLicensedAgent, ConciergeKey, Agent, CompanyAdmin

**Reads or writes:** reads only

| Input                     | Type                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `filter`                  | object                 | Loan filter applied before aggregation. All fields optional; results are always scoped to loans you can access.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `filter.searchText`       | string                 | Free-text match (case-insensitive) against the loan number and borrower first name, last name, and email. Whitespace-separated tokens must all match.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `filter.statuses`         | array of string        | Loan statuses to include (exact MLM status names, OR'd together), e.g. "Loan Funded", "Loan Closed", "Loan Underwriting", "Loan Processing", "Loan Clear To Close", "Loan Denied", "Loan Withdrawn". Call get\_loan\_reporting\_metadata for the full valid list. Note: "Loan Closed" and "Loan Clear To Close" are different statuses. IMPORTANT: this matches each loan's CURRENT status only — loans do not stay at "Loan Closed"/"Loan Funded" but move on to Sold/Purchased/Archived, so do NOT use this to count loans that closed/funded in a period; use report\_loan\_milestones (historical status crossings) for that.                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `filter.loanTypes`        | array of string        | Loan types to include (exact decoded names), e.g. "Conventional", "FHA", "VA", "USDA/Rural Housing", "Other". Call get\_loan\_reporting\_metadata for valid values. Matches the loan's `loanType` field (the decoded MLM sLT name) — NOT `mortgageLoanType`, which is a different MLM field (sMortgageLoanT) holding the loan's product class as a raw code (0=Government\_FHA\_VA\_RHS, 1=PrimeConforming, 2=PrimeNonConforming, 3=Other1To4UnitResidential, 4=ClosedEndSecond, 5=FundedHELOC, 6=Construction) and cannot express this enum: its code 0 covers FHA, VA and RHS together. CAUTION: loanType is unset on most loans, so this filter returns a small subset and a loan with no loanType is unknown, not Conventional; a few loans also carry the unnormalized value "CONV" that a filter on "Conventional" misses. Honored on report\_loans and loan\_pipeline\_report; on report\_loan\_milestones and conditions\_by\_outcome it currently matches the raw mortgageLoanType column instead, so these names silently return nothing there — use report\_loans for loan-type breakdowns. |
| `filter.purposes`         | array of string        | Loan purposes to include (exact names), e.g. "Purchase", "Refinance", "Refinance Cashout". Call get\_loan\_reporting\_metadata for valid values.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `filter.statusDateFrom`   | string (date-time)     | Include loans whose CURRENT status was set on/after this date (ISO 8601). This is when the loan last changed status — NOT when it closed/funded. Do NOT use this for "closed/funded in period X" questions (a closed loan's current status is usually a later one such as Sold or Archived); use report\_loan\_milestones for those.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `filter.statusDateTo`     | string (date-time)     | Include loans whose CURRENT status was set on/before this date (ISO 8601). Use end-of-day to include a full day. Same caveat as statusDateFrom: not suitable for "closed/funded in period X" — use report\_loan\_milestones.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.closingDateFrom`  | string (date-time)     | Include loans with a closing date on/after this date (ISO 8601). CAUTION: closingDate is sparsely populated (it is an estimated closing date, unset on most loans), so a 0-loan result usually means the field is missing, not that nothing closed — use report\_loan\_milestones for closed/funded-in-period questions.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `filter.closingDateTo`    | string (date-time)     | Include loans with a closing date on/before this date (ISO 8601). Same caution as closingDateFrom: sparsely populated; a 0-loan result usually means missing data.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `filter.updatedFrom`      | string (date-time)     | Include loans last updated on/after this date (ISO 8601).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `filter.updatedTo`        | string (date-time)     | Include loans last updated on/before this date (ISO 8601).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `filter.createdFrom`      | string (date-time)     | Include loans created (the application started in Henge) on/after this date (ISO 8601).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `filter.createdTo`        | string (date-time)     | Include loans created on/before this date (ISO 8601). Use end-of-day to include a full day.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `filter.loanOfficerIds`   | array of string (uuid) | Restrict to these loan-officer user IDs (GUIDs). Always intersected with your access scope — you can narrow but never widen what you can see. Obtain IDs from search\_users.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.referringAgentId` | string (uuid)          | Restrict to loans referred by this user ID (GUID).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `filter.processorId`      | string (uuid)          | Restrict to loans handled by this processor user ID (GUID).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `filter.loanAmountMin`    | number                 | Minimum loan amount in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `filter.loanAmountMax`    | number                 | Maximum loan amount in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `filter.commissionMin`    | number                 | Minimum locked compensation (commission) in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.commissionMax`    | number                 | Maximum locked compensation (commission) in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.propertyState`    | string                 | Two-letter subject-property state code, e.g. "FL".                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `filter.includeDeleted`   | boolean                | Include soft-deleted loans (default false). Deleted loans are hidden from the Henge UI and from every other report, so leaving this off is what makes a count match what the user sees on screen. Set true only to investigate a specific loan someone deleted, never to "find more loans".                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `filter.excludeTestData`  | boolean                | Leave test loans out even when you are a test user (default false). Test loans (a test user's loans, or a loan flagged IsTest) are already left out for every other caller; a test user sees them unless this is set. Set it for any report meant for the business, so it counts what everyone else sees.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `filter.excludeLosOnly`   | boolean                | Leave out loans that exist only in MLM (default false). These are loans originated in MLM and never in Henge, mostly from 2024: real closed, archived and withdrawn loans the retired data warehouse used to count, so they are included by default and the totals match what MLM holds. They have no record in the Henge app (no borrower portal, tasks or documents) and their loan officer may not be a Henge user. Set this to count only loans that went through Henge.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `groupBy`                 | string                 | Dimension to group by: None (single total), Status, LoanType, Purpose, LoanOfficer, ReferringAgent, Company, Day, Month, Quarter, Year. Day/Month/Quarter/Year bucket on the dateField. One of `None`, `Status`, `LoanType`, `Purpose`, `LoanOfficer`, `ReferringAgent`, `Month`, `Quarter`, `Year`, `Company`, `Day`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `thenBy`                  | array of string        | Optional: up to two more dimensions (same values as groupBy) for one bucket per combination, e.g. groupBy LoanOfficer with thenBy \["ReferringAgent","Company"] for loans per officer per referrer per company. Each bucket then lists every dimension's value in `keys`; `key` stays the groupBy value. Each dimension once, and at most one of Day/Month/Quarter/Year.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `metric`                  | string                 | Aggregate function for the primary metric: Count, Sum, Average, Min, Max. Count always returned; Sum/Average/Min/Max apply to metricField. (Count, Sum, Average, Min, and Max are all returned per bucket regardless; this records which one you asked for.) One of `Count`, `Sum`, `Average`, `Min`, `Max`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `metricField`             | string                 | Numeric field for Sum/Average/Min/Max: LoanAmount (default), LockedCompensation, EstimatedCompensation. Loans without a numeric value are ignored in Sum/Average/Min/Max. One of `LoanAmount`, `LockedCompensation`, `EstimatedCompensation`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `dateField`               | string                 | Date used when grouping by Day/Month/Quarter/Year: StatusDate (default), ClosingDate, Updated, Created (when the application was started in Henge). One of `StatusDate`, `ClosingDate`, `Updated`, `Created`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |

## report\_revenue\_projection

Projected income/loss from lock revenue for the current month and the ones after it (default this month and next). Revenue = Front-End (locked compensation) + Back-End (investor-lock projected profit), negative for a loss; gain on sale in bps = revenue / loan volume x 10,000. Each month has Funded (loans whose Funded milestone falls in the month, whatever their status now, so loans already sold or purchased still count), Projected (locked loans that have not funded and are not withdrawn, denied, cancelled or archived, by estimated closing date) and Total, each with loanCount, volume, frontEnd, backEnd, revenue and gainOnSaleBps. An estimated closing date that passed in the last 30 days counts in the current month and is flagged ClosingDatePassed; older or missing dates go to unscheduled, outside the totals. loans lists every loan counted, with flags (ClosingDatePassed, NoClosingDate, LockExpired, NoFrontEnd, NoBackEnd, Loss, OnHold). No test or deleted loans; loans that exist only in the LOS are not covered. Admin sees every company, or one with companyId; a CompanyAdmin always gets their own company.

**Who can call it:** Admin, CompanyAdmin

**Reads or writes:** reads only

| Input       | Type          | Description                                                                                                                |
| ----------- | ------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `months`    | integer       | How many months to cover, starting with the current one (1-6, default 2: this month and next).                             |
| `companyId` | string (uuid) | Admin only: one company's loans. Omit for every company. A CompanyAdmin always gets their own company and this is ignored. |

## search\_loan\_conditions

Search underwriting conditions and the requests under them across loans (filter by status such as "Submitted"/"Requested", condition category, assignee, and free text). Use this for processing questions like "which loans have conditions that need review". Results are always scoped to loans you can access.

**Who can call it:** Admin, Processor, DualLicensedAgent, ConciergeKey, Agent, CompanyAdmin

**Reads or writes:** reads only

| Input                     | Type                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `filter`                  | object                 | Loan filter. Date ranges, statuses, and officer/agent scoping apply; loan-amount/commission filters are ignored for tasks.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `filter.searchText`       | string                 | Free-text match (case-insensitive) against the loan number and borrower first name, last name, and email. Whitespace-separated tokens must all match.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `filter.statuses`         | array of string        | Loan statuses to include (exact MLM status names, OR'd together), e.g. "Loan Funded", "Loan Closed", "Loan Underwriting", "Loan Processing", "Loan Clear To Close", "Loan Denied", "Loan Withdrawn". Call get\_loan\_reporting\_metadata for the full valid list. Note: "Loan Closed" and "Loan Clear To Close" are different statuses. IMPORTANT: this matches each loan's CURRENT status only — loans do not stay at "Loan Closed"/"Loan Funded" but move on to Sold/Purchased/Archived, so do NOT use this to count loans that closed/funded in a period; use report\_loan\_milestones (historical status crossings) for that.                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `filter.loanTypes`        | array of string        | Loan types to include (exact decoded names), e.g. "Conventional", "FHA", "VA", "USDA/Rural Housing", "Other". Call get\_loan\_reporting\_metadata for valid values. Matches the loan's `loanType` field (the decoded MLM sLT name) — NOT `mortgageLoanType`, which is a different MLM field (sMortgageLoanT) holding the loan's product class as a raw code (0=Government\_FHA\_VA\_RHS, 1=PrimeConforming, 2=PrimeNonConforming, 3=Other1To4UnitResidential, 4=ClosedEndSecond, 5=FundedHELOC, 6=Construction) and cannot express this enum: its code 0 covers FHA, VA and RHS together. CAUTION: loanType is unset on most loans, so this filter returns a small subset and a loan with no loanType is unknown, not Conventional; a few loans also carry the unnormalized value "CONV" that a filter on "Conventional" misses. Honored on report\_loans and loan\_pipeline\_report; on report\_loan\_milestones and conditions\_by\_outcome it currently matches the raw mortgageLoanType column instead, so these names silently return nothing there — use report\_loans for loan-type breakdowns. |
| `filter.purposes`         | array of string        | Loan purposes to include (exact names), e.g. "Purchase", "Refinance", "Refinance Cashout". Call get\_loan\_reporting\_metadata for valid values.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `filter.statusDateFrom`   | string (date-time)     | Include loans whose CURRENT status was set on/after this date (ISO 8601). This is when the loan last changed status — NOT when it closed/funded. Do NOT use this for "closed/funded in period X" questions (a closed loan's current status is usually a later one such as Sold or Archived); use report\_loan\_milestones for those.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `filter.statusDateTo`     | string (date-time)     | Include loans whose CURRENT status was set on/before this date (ISO 8601). Use end-of-day to include a full day. Same caveat as statusDateFrom: not suitable for "closed/funded in period X" — use report\_loan\_milestones.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.closingDateFrom`  | string (date-time)     | Include loans with a closing date on/after this date (ISO 8601). CAUTION: closingDate is sparsely populated (it is an estimated closing date, unset on most loans), so a 0-loan result usually means the field is missing, not that nothing closed — use report\_loan\_milestones for closed/funded-in-period questions.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `filter.closingDateTo`    | string (date-time)     | Include loans with a closing date on/before this date (ISO 8601). Same caution as closingDateFrom: sparsely populated; a 0-loan result usually means missing data.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `filter.updatedFrom`      | string (date-time)     | Include loans last updated on/after this date (ISO 8601).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `filter.updatedTo`        | string (date-time)     | Include loans last updated on/before this date (ISO 8601).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `filter.createdFrom`      | string (date-time)     | Include loans created (the application started in Henge) on/after this date (ISO 8601).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `filter.createdTo`        | string (date-time)     | Include loans created on/before this date (ISO 8601). Use end-of-day to include a full day.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `filter.loanOfficerIds`   | array of string (uuid) | Restrict to these loan-officer user IDs (GUIDs). Always intersected with your access scope — you can narrow but never widen what you can see. Obtain IDs from search\_users.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.referringAgentId` | string (uuid)          | Restrict to loans referred by this user ID (GUID).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `filter.processorId`      | string (uuid)          | Restrict to loans handled by this processor user ID (GUID).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `filter.loanAmountMin`    | number                 | Minimum loan amount in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `filter.loanAmountMax`    | number                 | Maximum loan amount in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `filter.commissionMin`    | number                 | Minimum locked compensation (commission) in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.commissionMax`    | number                 | Maximum locked compensation (commission) in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.propertyState`    | string                 | Two-letter subject-property state code, e.g. "FL".                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `filter.includeDeleted`   | boolean                | Include soft-deleted loans (default false). Deleted loans are hidden from the Henge UI and from every other report, so leaving this off is what makes a count match what the user sees on screen. Set true only to investigate a specific loan someone deleted, never to "find more loans".                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `filter.excludeTestData`  | boolean                | Leave test loans out even when you are a test user (default false). Test loans (a test user's loans, or a loan flagged IsTest) are already left out for every other caller; a test user sees them unless this is set. Set it for any report meant for the business, so it counts what everyone else sees.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `filter.excludeLosOnly`   | boolean                | Leave out loans that exist only in MLM (default false). These are loans originated in MLM and never in Henge, mostly from 2024: real closed, archived and withdrawn loans the retired data warehouse used to count, so they are included by default and the totals match what MLM holds. They have no record in the Henge app (no borrower portal, tasks or documents) and their loan officer may not be a Henge user. Set this to count only loans that went through Henge.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `taskStatus`              | string                 | Task status to filter by, e.g. "Requested", "Submitted", "Accepted", "Rejected". Useful for finding tasks/conditions that need review.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `conditionCategory`       | string                 | Underwriting condition category to filter by.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `assignedToUserName`      | string                 | Filter to tasks assigned to a user whose name matches this text.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `top`                     | integer                | Max tasks to return (default 25).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `skip`                    | integer                | Number of tasks to skip for paging (default 0).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `orderBy`                 | string                 | Sort order passed through to the tasks pipeline (optional).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

## search\_loan\_tasks

Deprecated, use search\_loan\_conditions. This tool still works; planned removal 2027-01-31. Search loan tasks and underwriting conditions across loans (filter by task status such as "Submitted"/"Requested", condition category, assignee, and free text). Use this for processing questions like "which loans have tasks that need review". Results are always scoped to loans you can access.

**Who can call it:** Admin, Processor, DualLicensedAgent, ConciergeKey, Agent, CompanyAdmin

**Reads or writes:** reads only

| Input                     | Type                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `filter`                  | object                 | Loan filter. Date ranges, statuses, and officer/agent scoping apply; loan-amount/commission filters are ignored for tasks.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `filter.searchText`       | string                 | Free-text match (case-insensitive) against the loan number and borrower first name, last name, and email. Whitespace-separated tokens must all match.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `filter.statuses`         | array of string        | Loan statuses to include (exact MLM status names, OR'd together), e.g. "Loan Funded", "Loan Closed", "Loan Underwriting", "Loan Processing", "Loan Clear To Close", "Loan Denied", "Loan Withdrawn". Call get\_loan\_reporting\_metadata for the full valid list. Note: "Loan Closed" and "Loan Clear To Close" are different statuses. IMPORTANT: this matches each loan's CURRENT status only — loans do not stay at "Loan Closed"/"Loan Funded" but move on to Sold/Purchased/Archived, so do NOT use this to count loans that closed/funded in a period; use report\_loan\_milestones (historical status crossings) for that.                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `filter.loanTypes`        | array of string        | Loan types to include (exact decoded names), e.g. "Conventional", "FHA", "VA", "USDA/Rural Housing", "Other". Call get\_loan\_reporting\_metadata for valid values. Matches the loan's `loanType` field (the decoded MLM sLT name) — NOT `mortgageLoanType`, which is a different MLM field (sMortgageLoanT) holding the loan's product class as a raw code (0=Government\_FHA\_VA\_RHS, 1=PrimeConforming, 2=PrimeNonConforming, 3=Other1To4UnitResidential, 4=ClosedEndSecond, 5=FundedHELOC, 6=Construction) and cannot express this enum: its code 0 covers FHA, VA and RHS together. CAUTION: loanType is unset on most loans, so this filter returns a small subset and a loan with no loanType is unknown, not Conventional; a few loans also carry the unnormalized value "CONV" that a filter on "Conventional" misses. Honored on report\_loans and loan\_pipeline\_report; on report\_loan\_milestones and conditions\_by\_outcome it currently matches the raw mortgageLoanType column instead, so these names silently return nothing there — use report\_loans for loan-type breakdowns. |
| `filter.purposes`         | array of string        | Loan purposes to include (exact names), e.g. "Purchase", "Refinance", "Refinance Cashout". Call get\_loan\_reporting\_metadata for valid values.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `filter.statusDateFrom`   | string (date-time)     | Include loans whose CURRENT status was set on/after this date (ISO 8601). This is when the loan last changed status — NOT when it closed/funded. Do NOT use this for "closed/funded in period X" questions (a closed loan's current status is usually a later one such as Sold or Archived); use report\_loan\_milestones for those.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `filter.statusDateTo`     | string (date-time)     | Include loans whose CURRENT status was set on/before this date (ISO 8601). Use end-of-day to include a full day. Same caveat as statusDateFrom: not suitable for "closed/funded in period X" — use report\_loan\_milestones.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.closingDateFrom`  | string (date-time)     | Include loans with a closing date on/after this date (ISO 8601). CAUTION: closingDate is sparsely populated (it is an estimated closing date, unset on most loans), so a 0-loan result usually means the field is missing, not that nothing closed — use report\_loan\_milestones for closed/funded-in-period questions.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `filter.closingDateTo`    | string (date-time)     | Include loans with a closing date on/before this date (ISO 8601). Same caution as closingDateFrom: sparsely populated; a 0-loan result usually means missing data.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `filter.updatedFrom`      | string (date-time)     | Include loans last updated on/after this date (ISO 8601).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `filter.updatedTo`        | string (date-time)     | Include loans last updated on/before this date (ISO 8601).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `filter.createdFrom`      | string (date-time)     | Include loans created (the application started in Henge) on/after this date (ISO 8601).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `filter.createdTo`        | string (date-time)     | Include loans created on/before this date (ISO 8601). Use end-of-day to include a full day.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `filter.loanOfficerIds`   | array of string (uuid) | Restrict to these loan-officer user IDs (GUIDs). Always intersected with your access scope — you can narrow but never widen what you can see. Obtain IDs from search\_users.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.referringAgentId` | string (uuid)          | Restrict to loans referred by this user ID (GUID).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `filter.processorId`      | string (uuid)          | Restrict to loans handled by this processor user ID (GUID).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `filter.loanAmountMin`    | number                 | Minimum loan amount in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `filter.loanAmountMax`    | number                 | Maximum loan amount in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `filter.commissionMin`    | number                 | Minimum locked compensation (commission) in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.commissionMax`    | number                 | Maximum locked compensation (commission) in USD (inclusive).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filter.propertyState`    | string                 | Two-letter subject-property state code, e.g. "FL".                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `filter.includeDeleted`   | boolean                | Include soft-deleted loans (default false). Deleted loans are hidden from the Henge UI and from every other report, so leaving this off is what makes a count match what the user sees on screen. Set true only to investigate a specific loan someone deleted, never to "find more loans".                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `filter.excludeTestData`  | boolean                | Leave test loans out even when you are a test user (default false). Test loans (a test user's loans, or a loan flagged IsTest) are already left out for every other caller; a test user sees them unless this is set. Set it for any report meant for the business, so it counts what everyone else sees.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `filter.excludeLosOnly`   | boolean                | Leave out loans that exist only in MLM (default false). These are loans originated in MLM and never in Henge, mostly from 2024: real closed, archived and withdrawn loans the retired data warehouse used to count, so they are included by default and the totals match what MLM holds. They have no record in the Henge app (no borrower portal, tasks or documents) and their loan officer may not be a Henge user. Set this to count only loans that went through Henge.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `taskStatus`              | string                 | Task status to filter by, e.g. "Requested", "Submitted", "Accepted", "Rejected". Useful for finding tasks/conditions that need review.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `conditionCategory`       | string                 | Underwriting condition category to filter by.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `assignedToUserName`      | string                 | Filter to tasks assigned to a user whose name matches this text.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `top`                     | integer                | Max tasks to return (default 25).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `skip`                    | integer                | Number of tasks to skip for paging (default 0).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `orderBy`                 | string                 | Sort order passed through to the tasks pipeline (optional).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://api-docs.hengelending.com/mcp/tool-reference/reporting.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
