Skip to content
Agentmart
Submit a tool

GWS JSON Filter

Filter large GWS CLI JSON responses (calendar events, emails, etc.) by specific fields like title, attendee, date.

Skill by agentsfusion

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/agentsfusion-gws-json-filter

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Filter large GWS CLI JSON responses (calendar events, emails, etc.) by specific fields like title, attendee, date. Prevents LLM context overflow by extracting only matching items programmatically.

Use cases: ml, productivity

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/gws-json-filter

What's inside

Skill name
GWS JSON Filter
Description
Filter large GWS CLI JSON responses (calendar events, emails, etc.) by specific fields like title, attendee, date. Prevents LLM context overflow by extracting only matching items programmatically.
License
MIT
Instructions
225 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • name: only lowercase letters, digits and single hyphens allowed
  • name: "GWS JSON Filter" does not match folder "gws-json-filter"

Files (1)

  • SKILL.md

SKILL.md (first lines)

# GWS JSON Filter

## When to Use

Use this skill whenever a `gws` CLI command returns a large JSON response and you need to find specific items. **Do NOT visually scan large JSON output** — use `execute_code` to filter programmatically.

Common scenarios:
- Find calendar events by title/summary (e.g. "find all events named TrailblazerDX")
- Find calendar events by attendee email
- Find calendar events within a date range
- Find emails by subject or sender
- Any `gws` response with more than ~10 items

## ⚠️ Two-Step Pattern (MUST follow)

`python3 -c` is blocked in bash mode. You **MUST** use two separate `execute_code` calls. Both calls share the same working directory (`workspace/`), so files persist between calls.

### Step 1 — Fetch and save to file (`execute_code(language="bash")`)

Use shell redirect `>` to save gws output to a file. Do **NOT** use the gws `-o` flag — it may fail silently.

**⚠️ NEVER use `set -e` in the bash script.** Always start with `set +e` to prevent the script from aborting on non-zero exit codes. The gws command may return non-zero even on partial success, and `set -e` will kill the script before the status check runs.

```bash
set +e
gws calendar events list --params '{"calendarId":"primary","q":"keyword"}' > _events_raw.json 2>&1
echo "OK: saved to _events_raw.json"
```

**Check the output!** If Step 1 shows a gws error, do NOT proceed to Step 2 — fix the gws command first.

The `q` parameter does a broad text search (matches summary, description, location). Use it to pre-filter when possible.

For paginated results, add `--page-all`:
```bash
set +e
gws calendar events list --params '{"calendarId":"primary"}' --page-all > _events_raw.json 2>&1
echo "OK"
```

**Important:** `>` redirects stdout to the file. The gws JSON output goes into the file instead of printing to the terminal, keeping your context clean.

### Step 2 — Filter with Python (`execute_code(language="python")`)

**Only proceed if Step 1 printed "OK".**

All examples below automatically **skip cancelled/deleted events** by filtering on the `status` field. Google Calendar events have `status` = `confirmed`, `tentative`, or `cancelled`. Only `confirmed` and `tentative` are active events.

#### Common helper — parse JSON file and filter out inactive events:
Every filter script should start with this pattern:
```python
import json, os, sys

filepath = '_events_raw.json'
if not os.path.exists(filepath):
    print(f"ERROR: {filepath} not found. Step 1 (gws command) likely failed.")
    sys.exit(1)

with open(filepath) as f:
    content = f.read().strip()

if content.startswith('{'):
    raw_items = json.loads(content).get('items', [])
else:
    raw_items = []
    for line in content.splitlines():
        line = line.strip()
        if line:
            raw_items.extend(json.loads(line).get('items', []))

INACTIVE_STATUSES = {'cancelled', 'deleted'}
items = [e for e in raw_items if e.get('status', '').lower() not in INACTIVE_STATUSES]
print(f"Loaded {len(raw_items)} total event(s), {len(raw_items) - len(items)} cancelled/deleted, {len(items)} active.")
```

#### Filter by title (summary):
```python
import json, os, sys

filepath = '_events_raw.json'
if not os.path.exists(filepath):
    print(f"ERROR: {filepath} not found. Step 1 (gws command) likely failed.")
    sys.exit(1)

with open(filepath) as f:
    content = f.read().strip()

if content.startswith('{'):
    raw_items = json.loads(content).get('items', [])
else:
    raw_items = []
    for line in content.splitlines():
        line = line.strip()
        if line:
            raw_items.extend(json.loads(line).get('items', []))

INACTIVE_STATUSES = {'cancelled', 'deleted'}
items = [e for e in raw_items if e.get('status', '').lower() not in INACTIVE_STATUSES]
print(f"Loaded {len(raw_items)} total, {len(raw_items) - len(items)} inactive, {len(items)} active.")

keyword = "TrailblazerDX"
matches = [e for e in items if keyword.lower() in e.get('summary', '').lower()]

for e in matches:
    print(f"ID: {e['id']}")
    print(f"  Title: {e.get('summary','')}")
    print(f"  Status: {e.get('status','')}")
    print(f"  Start: {e.get('start',{}).get('dateTime','')}")
    print(f"  Attendees: {[a.get('email','') for a in e.get('attendees',[])]}")
    print()

print(f"Found {len(matches)} matching active event(s).")

os.remove(filepath)
```

#### Filter by attendee email:
```python
import json, os, sys

From agentsfusion/WorkMagicSkills, MIT.

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Apr 19, 2026 (6 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from agentsfusion

Cite this page

GWS JSON Filter skill. Agent Mart. https://agentmart.dev/skills/agentsfusion-gws-json-filter (last updated 2026-10-24)