Repository navigation
Get‑ShpContextReport
Accounts where a request's estimated Context tokens would go, source by source, without sending anything.
Get-ShpContextReport [[-Prompt] <String>] [[-SystemPrompt] <String>] [[-AppendSystemPrompt] <String>]
[[-SystemPromptPath] <String[]>] [[-InstructionPath] <String[]>] [[-InstructionRoot] <String[]>]
[[-SkillPath] <String[]>] [-IncludeSkillBody] [[-Attachment] <String[]>] [[-Image] <String[]>]
[[-History] <Object[]>] [[-Model] <String>] [[-MaxContextWindowTokens] <Int32>] [[-Mode] <String>]
[[-Tool] <String[]>] [[-ExcludeTool] <String[]>] [-DeferredToolLoading] [-DisableBrowsing]
[-DisableFileAccess] [-DisableTerminal] [-DisableUserPrompts] [-DisableTodoList] [-DisableUserTools]
[-DisableMcp] [<CommonParameters>]
Composes exactly what Invoke-Shp would put in front of the model for the options given - the built-in system content, the caller's instructions, the Skill and Instruction catalogs, the offered Tool schemas, inlined attachments, the Session chat, the prompt and any Tool results already in the conversation - and attributes the estimated token cost of each to its own row.
It answers the question a context window actually raises: not "how big is this" but "what is taking up the room". A Turn that overflows is usually paying for something the caller did not realise was there - a registered Tool schema nobody calls, an instruction file that grew, a Tool result from six iterations ago - and a single total cannot show any of that.
NOTHING is sent. No provider call, no credential, no token exchange, no Server contact. The composition uses the same private seams the real Turn uses (New-ShpToolOffer, New-ShpSystemContent), so the schemas and the system text reported are the ones that would be sent, not a second implementation's idea of them.
Every Known row is measured with the SAME estimator, ConvertTo-ShpTokenCount, and the total is the sum of those rows, so the breakdown and the total cannot disagree. A contribution that cannot be sized locally is reported with a null count and a stated reason instead of a zero: an image is tokenized by the provider, and a Skill body has not been loaded until the model asks for it. Provider-side framing overhead is not modelled, and the service's reported usage stays authoritative.
With -DeferredToolLoading the report shows the offer as the Turn would make it - eligible User and MCP schemas withheld, search_tools in their place - and states separately how many schemas were withheld and what they would have cost. That is the measurement that makes Deferred Tool loading a decision rather than a guess.
Get-ShpContextReport -Prompt 'Summarise the build failure.'
Shows where the estimated Context tokens of that call would go.
Get-ShpContextReport -Prompt $prompt -DeferredToolLoading
Shows the same call with dynamic Tool schemas withheld, and states how many schemas were withheld and what they would have cost.
(Get-ShpContextReport -Prompt $prompt).Sources | Sort-Object EstimatedTokens -Descending
Ranks the sources so the largest contributor is first.
Extra inline guidance appended after any other instruction.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseFiles that would be attached. Text is inlined and accounted; a binary contributes its manifest entry; an image is reported as unknown.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 8
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseReport the offer as a Deferred Tool loading Turn would make it.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseAccount the offer without fetch_url.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseAccount the offer without the file tools.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseAccount the offer without MCP tools.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseAccount the offer without the Terminal tool.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseAccount the offer without manage_todo_list.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseAccount the offer without ask_user.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseAccount the offer without registered User tools.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseAccount the offer without these Tool names.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 15
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseAccount this conversation instead of the Session chat, in the same shape Invoke-Shp -History accepts. A tool-role entry is attributed to Tool results rather than to Session chat.
Type: Object[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 10
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseImages that would ride in the user message. Reported as unknown, because the provider tokenizes them.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 9
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseAlso read and account every discovered Skill body, answering what loading all of them would cost. Off by default, because a body is not in the Context until the model calls load_skill and reporting it as if it were would overstate the request.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseOne or more instruction files whose bodies are injected.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseOne or more folders scanned for instruction files offered by name.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseContext budget to report against; 0 reports no remaining figure. Omit it to resolve the budget the way a Turn would.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 12
Default value: 0
Accept pipeline input: False
Accept wildcard characters: FalseDefault or Plan, which narrows the offered Tool schemas.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 13
Default value: Default
Accept pipeline input: False
Accept wildcard characters: FalseThe model the budget is resolved for. Defaults to the Session default.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 11
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe prompt that would be sent. Optional: a report with no prompt sizes everything that surrounds one.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseOne or more folders scanned for Skills offered by name.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 7
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseInline system prompt, as Invoke-Shp would apply it.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseOne or more system-prompt files, front-matter stripped.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseAccount only these Tool names, as Invoke-Shp -Tool would.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 14
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
- Clear-ShpChat
- Clear-ShpContext
- Clear-ShpRedactionPolicy
- Clear-ShpToolPolicy
- Clear-ShpUsage
- Compress-ShpChat
- ConvertTo-ShpAnnotation
- ConvertTo-ShpOtelTrace
- ConvertTo-ShpTokenCount
- Get-ShpChat
- Get-ShpChatCheckpoint
- Get-ShpContext
- Get-ShpContextReport
- Get-ShpCosineSimilarity
- Get-ShpCostEstimate
- Get-ShpDefault
- Get-ShpMcpServer
- Get-ShpModel
- Get-ShpModelName
- Get-ShpRedactionPolicy
- Get-ShpTool
- Get-ShpToolPolicy
- Get-ShpUsage
- Initialize-Shp
- Invoke-Shp
- Invoke-ShpBatch
- Invoke-ShpEval
- Invoke-ShpSubagent
- Register-ShpMcpServer
- Register-ShpTool
- Request-ShpEmbedding
- Resolve-ShpError
- Restore-ShpChat
- Save-ShpChat
- Select-ShpModel
- Set-ShpContext
- Set-ShpRedactionPolicy
- Set-ShpToolPolicy
- Start-ShpChat
- Test-ShpCiReadiness
- Unregister-ShpMcpServer
- Unregister-ShpTool