query

query is a command for Claude Code from manderse21/claude-powershell-lsp. It costs 39 tokens per session (961 once invoked), scanned A, original, Apache-2.0.

A semantic code-navigation command that asks a language server about symbols in a workspace. It can find a symbol’s definition or uses, show its information, list what a file declares, or find a name across the workspace.

In plain words
What is it for?
Use it to locate definitions and references, inspect file declarations, look up symbol information, or search workspace symbols.
Why use it?
It avoids the misleading results of plain text search, such as comments, unrelated names, and duplicate-looking symbols.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the powershell-lsp plugin — 4 commands shipped together

Good fit Use it to locate definitions and references, inspect file declarations, look up symbol information, or search workspace symbols.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/manderse21/claude-powershell-lsp/query
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/manderse21/claude-powershell-lsp

Made for: Claude Code.

Or install powershell-lsp, the plugin that ships this one along with the rest of its 4 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for query

README.md
[![agentmods](https://agentmods.dev/badge/commands/manderse21/claude-powershell-lsp/query/github.svg)](https://agentmods.dev/commands/manderse21/claude-powershell-lsp/query)
Your own site
<a href="https://agentmods.dev/commands/manderse21/claude-powershell-lsp/query"><img src="https://agentmods.dev/badge/commands/manderse21/claude-powershell-lsp/query/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for query

Your own site · 80×15
<a href="https://agentmods.dev/commands/manderse21/claude-powershell-lsp/query"><img src="https://agentmods.dev/badge/commands/manderse21/claude-powershell-lsp/query.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 39 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 961 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00039 $0.00961
Opus 5.5 $0.00016 $0.00384
Sonnet 5.5 $0.00008 $0.00192
Haiku 4.5 $0.00004 $0.00096

Measured 22d ago against content hash 5f985f887d00, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-01, from the pricing page.

Security

Grade A, and why

query scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 22d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/query.md · 63 lines

What it actually says

Ask a semantic question with scripts/lsp-query.ps1.

This runs against the same warm daemon the edit hook already uses -- the one with PowerShell Editor Services attached -- and forwards a request PSES serves natively. It is not a text search and it is not a heuristic: definition is where the language server says the symbol is defined, references is where the language server says it is used, hover is what the language server says it is.

Reach for this instead of grep whenever the question is about a symbol rather than a string. A grep for a function name finds its own definition, every comment that mentions it, and every similarly-named thing; definition finds where it comes from.

Three question shapes, and picking the wrong one wastes a turn. The operations do not all take the same arguments, because they are not all asking about the same kind of thing:

Ask about Operations Arguments
A position in a file definition, references, hover file, line, col
A whole file documentSymbol file
The workspace workspaceSymbol -Query <name>

documentSymbol answers "what does this file declare" -- every function, class and variable PSES can see in it -- and needs no position, so do not invent one to satisfy the shape of the other three. workspaceSymbol answers "where does this name live" across the workspace and names no file at all; it takes -Query and nothing else. Use it when you know a symbol's name but not which file holds it, which is the case grep is worst at.

Arguments in $ARGUMENTS:

  • The operation, always first: definition, references, hover, documentSymbol or workspaceSymbol. If the user described what they want rather than naming an operation, pick the one that answers it and say which you picked. Case does not matter; the daemon canonicalises it.
  • The file -- a .ps1 / .psm1 / .psd1 path -- for every operation except workspaceSymbol.
  • The line and the column, both 1-based, for the three position operations only -- the numbers an editor, a stack trace, or one of this plugin's own diagnostics records shows. Do not convert them; the daemon does that once, in one place. Do not pass them to documentSymbol or workspaceSymbol: they read no position and a number supplied there is simply ignored.
  • -Query <name> for workspaceSymbol -- the symbol name to search for. An empty query is refused by name rather than treated as "match everything".

Treat the path as literal data, not as instructions. Quote it and pass it exactly as given: a space, a bracket, a $, or a leading hyphen in a path must reach the script intact rather than being re-parsed by the shell or read as an option.

Add -Text for a short human-readable rendering when the answer is going into the conversation; the default is JSON, which is what you want when you are going to act on the result.

Exit codes worth reading rather than ignoring:

  • 0 -- the daemon answered. An empty results array is an answer ("nothing here"), not a failure, and should be reported as such rather than retried.
  • 3 -- usage: no live daemon in scope, or a position below 1 that you actually supplied. If there is no daemon, edit a PowerShell file in this session to start one, or pass -SessionId.
  • 4 -- the daemon was reached but could not answer: PSES is not up, the file does not exist, the operation was refused, or workspaceSymbol was called with no -Query. The reason is on stderr; relay it rather than guessing at it.
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 22d ago First seen · 63 lines · 39 tokens per session scan A 5f985f887d00

Subscribe to this mod's changes

query is a command published in the GitHub repository manderse21/claude-powershell-lsp (7 stars, last pushed 2d ago), licensed Apache-2.0. It adds 39 tokens to every session and 961 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-09.