googleapis / googleapis/gcloud-mcp
run_gcloud_command splits args containing spaces (breaks filter expressions)
- Dominant language
- TypeScript
- Stars
- 904
- Forks
- 83
- PR merge metrics
- No merged PRs in 30d
Description
## Description
When passing a compound filter expression as a single element in the `args` array to `run_gcloud_command`, the server appears to split the argument on spaces, causing `gcloud` to receive them as separate positional arguments.
## Steps to Reproduce
Call `run_gcloud_command` with a `gcloud logging read` filter:
```json
{
"args": [
"logging",
"read",
"resource.type=cloud_run_revision AND resource.labels.service_name=temporal-ui AND severity>=WARNING",
"--project=my-project",
"--limit=30",
"--format=json(timestamp,severity,textPayload,jsonPayload)"
]
}
```
## Expected Behavior
The filter string should be passed as a single argument to `gcloud`, equivalent to:
```bash
gcloud logging read 'resource.type=cloud_run_revision AND resource.labels.service_name=temporal-ui AND severity>=WARNING' --project=my-project --limit=30 --format=json(...)
```
## Actual Behavior
```
Error: UnrecognizedArgumentsError: unrecognized arguments:
AND
resource.labels.service_name=temporal-ui
severity>=WARNING (did you mean '--verbosity'?)
```
The `AND` and subsequent filter clauses are treated as separate arguments, indicating the single array element was split on spaces somewhere in the execution pipeline.
## Environment
- `@google-cloud/gcloud-mcp` v0.5.3
- Client: Claude Code (CLI)
- macOS, Node.js 22
## Notes
This likely affects any `gcloud` subcommand that accepts a positional argument containing spaces (e.g., `logging read FILTER`, `compute instances list --filter=EXPR`). Commands with simple args like `run services describe` work correctly.
Possible cause: the `gcloud meta lint-gcloud-commands` validation step or the argument passing to `child_process.spawn` may be joining and re-splitting the args array.
Contributor guide
Assessment
This issue has not been assessed yet.