Skip to main content
Glama

Xearno Tools

US Substantial Presence Test — the real 183-day rule

us_substantial_presence_test
Read-only

Whether your US days make you a tax resident — the weighted 3-year formula where 122 days a year is enough, and student-visa days may not count at all. Determines US tax residency under the Substantial Presence Test (IRC §7701(b)): 31+ days this year AND a weighted total ≥ 183, counting this year’s days in full, last year’s at one-third, and the year before at one-sixth. The popular "stay under 183 days" rule is wrong — a steady 122 days every year triggers residency. The inputs that actually decide the answer are the ones people don’t know matter: visa status (F/J/M/Q student and J/Q teacher days can be excluded entirely — or suddenly start counting), prior-year day counts, and whether the closer connection exception (Form 8840) is still open — it closes at 183 actual days, and a pending green-card application bars it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusNoUS immigration status this year The decisive input, and the one almost nobody knows matters. A green card makes you a resident regardless of days. F/J/M/Q student and J/Q teacher visas can make your days NOT count at all — or, past a limit, suddenly count. Most work and visitor statuses (H-1B, L-1, B1/B2, ESTA) have no special rule: pick the first option.none
daysPrior1NoDays in the US in the 1st preceding year Last calendar year’s day count, same counting rules. It is weighted at one-third — prior years are why "under 183 this year" is not safe.
daysPrior2NoDays in the US in the 2nd preceding year The calendar year before that, weighted at one-sixth.
daysCurrentNoDays in the US this calendar year Any part of a day counts as a full day — an evening arrival is a day. But first REMOVE days that never count: regular-commuter days from Canada/Mexico, under-24h transits between two foreign points, days as crew of a foreign vessel, and days you could not leave because of a medical condition that arose in the US.
exemptYearsNoExempt calendar years Only used for student/teacher status; two meanings. Student (F/J/M/Q): the calendar years you have EVER spent as an exempt student, teacher, or trainee — cumulative over your lifetime, any part of a year counts as a full year, and include this year if it applies. Teacher/trainee (J/Q): how many of the 6 PRECEDING calendar years you were exempt.
closerConnectionNoForeign tax home with a closer connection? If the test is met but you spent under 183 actual days, the closer connection exception can still keep you a nonresident: a tax home in a foreign country for the entire year plus a closer connection to it, claimed on a timely Form 8840.unsure

TDQS

A4.5/5.0
Behavior5/5

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

The description fully discloses the calculation logic, including the weighted formula, visa exclusions, and the closer connection exception. It warns about common misunderstandings and explains how each parameter affects the result. Annotations indicate readOnlyHint=true, which aligns with this being a calculation tool.

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

Conciseness4/5

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

The description is lengthy but well-structured, starting with a clear summary and then drilling into details. Every sentence provides useful information, though some redundancy could be trimmed.

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

Completeness4/5

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

Given the complexity and lack of output schema, the description covers the test thoroughly, including edge cases and exceptions. It does not explicitly state the output format, but the determination is implied.

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

Parameters4/5

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

The description adds significant value beyond the schema by explaining the practical impact of each parameter (e.g., why visa status is decisive, how to count days, the meaning of exempt years). Schema coverage is 100%, so baseline is 3; the extra context justifies a 4.

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

Purpose5/5

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

The description clearly states the tool determines US tax residency under the Substantial Presence Test, explains the weighted 3-year formula, and dispels the common myth. The title and description distinguish it from similar tools like UK or NY statutory residence tests.

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

Usage Guidelines4/5

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

The description provides context on when the test applies (for US tax residency) and educates about key exceptions like student visas and the closer connection exception. It doesn't explicitly contrast with sibling tools, but the domain is clearly US-specific.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

TDQS

A3.9/5.0
Disambiguation4/5

Each tool targets a distinct niche (e.g., specific country tax rules, loan types, or legal calculations), with detailed descriptions that clarify boundaries. However, the large number of tools (66) could cause some confusion for an agent trying to select the right one for a general query, especially when multiple tools relate to the same country.

Naming Consistency4/5

Tool names follow a mostly predictable pattern: lowercase words separated by underscores, often starting with a country name (e.g., 'uk_stamp_duty_sdlt') or a topic (e.g., 'compound_growth'). There are minor deviations, such as abbreviations ('npv_irr', 'sip') and varying use of verbs, but overall the naming is clear and consistent.

Tool Count3/5

At 66 tools, the server is unusually large and covers an extensive range of financial and legal calculators. While each tool justifies its existence, the count exceeds the typical well-scoped range (3–15), making the server feel bloated. A more modular design might improve coherence.

Completeness4/5

The tool set covers a wide array of domains: personal income taxes, property taxes, loan calculations, investment returns, and specific country regulations. Minor gaps exist (e.g., missing tools for corporate taxes, general retirement planning, or insurance), but the overall coverage is thorough and addresses many niche scenarios that general AI handles poorly.

Resources