Top-level query functions aren't parsed correctly
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
### Describe the bug
When a command includes a `--query` flag with a top-level function, the last character of the query isn't evaluated.
Example:
```
> az group list --query "length([])"
argument --query: invalid jmespath_type value: 'length([]'
```
If I include at least one extra space (or `=`) in the query, things work:
```
> az group list --query "length([]) "
84
```
### Related command
This seems to be a core issue - I've found the same results with three different provider commands.
### Errors
```
> az group list --query "length([])"
argument --query: invalid jmespath_type value: 'length([]'
```
### Issue script & Debug output
The `--debug` flag doesn't work because of the parsing issue:
```
> az group list --query "length([])" --debug
--debug was unexpected at this time.
```
### Expected behavior
I expect top-level query functions to work without whitespace padding.
### Environment Summary
azure-cli 2.77.0 *
core 2.77.0 *
telemetry 1.1.0
Extensions:
account 0.2.5
application-insights 1.2.2
azure-devops 1.0.2
fzf 1.0.2
healthcareapis 1.0.1
load 1.1.1
providerhub 1.0.0b2
resource-graph 2.1.0
Dependencies:
msal 1.34.0b1
azure-mgmt-resource 23.3.0
Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Config directory 'C:\Users\jovinson\.azure'
Extensions directory 'C:\Users\jovinson\.azure\cliextensions'
Python (Windows) 3.13.7 (tags/v3.13.7:bcee1c3, Aug 14 2025, 14:15:11) [MSC v.1944 64 bit (AMD64)]
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.