zai-web-search
Skill4 starsChanged 20 days agoMITView on GitHub
Search the live web via z.ai web_search_prime (GLM Coding Plan MCP server). Use when the user wants current information, recent trends, news, blog posts, docs, or any web resource that academic-database search (reference-search) does not cover. Triggers on web search, 웹 검색, search the web, 최근 동향, 최신 트렌드, latest trends, find online, 인터넷에서 찾아, what's new, current state of X, search z.ai, GLM web search.
In this repository38 other files it gives its agents.
- academic-cvSkill
- academic-jobsSkill
- academic-proseSkill
- adversarial-reviewSkill
- bibtex-genSkill
- chrome-sessionSkill
- clickup-cliSkill
- clickup-todaySkill
- commit-triageSkill
- concept-explainerSkill
- contact-emailSkill
- cover-letterSkill
- dropboxSkill
- handdrawn-schematicSkill
- hep-rumor-millSkill
- journal-club-reviewSkill
- magi-researchSkill
- md2pdf-typoraSkill
- morgenSkill
- overleaf-section-workflowSkill
- overleapSkill
- peer-agent-reviewSkill
- proton-mailSkill
- reference-searchSkill
- remarkable-syncSkill
- research-backupSkill
- research-boardSkill
- research-logSkill
- research-portalSkill
- research-proposalSkill
- research-reportSkill
- research-statementSkill
- scienceplot-pySkill
- vastaiSkill
- wide-slide-illustratorSkill
- workshop-paper-reviewSkill
- xkcd-pySkill
- zoom-summarySkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 42
If either fails, tell the user:
- Very specific: line 45
Do not create a second credential file.
- Very specific: line 75
When a result looks like an arXiv/paper link and you need BibTeX or abstract text, hand off to reference-search or bibtex-gen with the …
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
zai-web-search
Live web search through z.ai's web_search_prime MCP server, included with the GLM Coding Plan subscription (no separate API recharge needed — see references/protocol_notes.md for why this matters and why the script uses MCP and not the REST API).
The single Python script handles the MCP streamable-HTTP handshake, SSE parsing, and the multiply-escaped JSON response so you can just call it.
Division of labor with reference-search
These two skills are complementary, not competing:
| Skill | Sources | Best for | Output shape |
reference-search | InspireHEP / OpenAlex / Semantic Scholar APIs | Academic papers, metadata, BibTeX, abstracts, citation context, baselines | Markdown-ready citations with quoted match sentences |
zai-web-search (this) | Live web via z.ai search-prime | Recent trends, news, blogs, docs, non-academic resources, "what is the field doing right now" | title / link / snippet per result |
Default routing:
- "Find papers on X", "baseline citation for Y", "section needs references" →
reference-search - "Latest trends in X", "what is the community doing about Y", "search the web for Z", anything outside academic DBs →
zai-web-search - A claim that needs both a primary source (academic) and current context (web) → run both and merge.
Trigger conditions
Invoke this skill when the user says any of:
- "search the web for X", "웹 검색", "인터넷에서 찾아봐"
- "latest / recent trends in X", "최근 동향", "최신 트렌드", "what's new in X"
- "current state of X", "how is the field approaching Y"
- a web-lookup need that is clearly not an academic-DB query (news, blogs, docs, repos, product pages)
- explicit "z.ai search" / "GLM web search" / "use the web"
Prerequisites
The key is the single source of truth — pi's own credential store, not a duplicate:
test -f ~/.pi/agent/auth.json
python3 -c "import json,os;print(json.load(open(os.path.expanduser('~/.pi/agent/auth.json')))['zai-coding-cn']['key'])" >/dev/nullIf either fails, tell the user:
The z.ai key is not configured in
~/.pi/agent/auth.jsonunderzai-coding-cn.key. This key ships with the GLM Coding Plan login — it is the same key pi already uses for the default model. Re-login via pi if it is missing.
Do not create a second credential file. Do not ask the user to paste the key into a skill config. auth.json is the SoT.
Script usage
python3 scripts/web_search.py "<query>" [--limit 8] [--domain example.com] [--json] [--auth PATH]Arguments:
query(positional or--query/-q): the search query. MCP recommends ≤70 chars; the script hard-rejects >200.--limit/-n(default 8): max results.--domain: restrict to a domain (e.g.arxiv.org,nature.com). Optional. Results are also checked locally because the upstream filter may return off-domain items.--json: machine-readable output for piping into another script. Default is human-readable[i] title / link / snippet.--auth(default~/.pi/agent/auth.json): override the credential path (rarely needed).
Resolve the script path relative to this SKILL.md (skill dir + scripts/web_search.py).
Examples
# human-readable, top 6 results
python3 scripts/web_search.py "autoregressive sampler Ising correlation failure" -n 6
# restrict to arXiv, JSON for downstream processing
python3 scripts/web_search.py "flow sampler critical slowing down" --domain arxiv.org --json
# pipe into a quick relevance filter
python3 scripts/web_search.py "..." --json | python3 -c "import sys,json; ..."How to use the results
- The script prints title / link / snippet. Snippets are short summaries from the search engine, not the page content — do not treat them as quotes from the source.
- For anything you plan to cite, open the link and verify the claim against the real page before quoting. Web-search snippets are for discovery and triage, not citation.
- When a result looks like an arXiv/paper link and you need BibTeX or abstract text, hand off to
reference-searchorbibtex-genwith the arXiv ID / DOI.
Error handling
| Exit code | Meaning | Action |
| 0 | success | use the printed results |
| 1 | bad argument (query empty / too long) | fix the call |
| 2 | auth.json missing or no zai-coding-cn.key | user must (re-)configure pi login |
| 3 | auth rejected (HTTP 401 / MCP -401) | key invalid or expired → re-login via pi |
| 4 | search-side error (429, 5xx, MCP error) | surface the message; retry once after a short wait for transient 429 |
| 5 | network or parse failure | transient HTTP/TLS failures are retried twice; then show stderr and check connectivity |
| 64 | usage error | show --help |
Do not auto-retry on auth errors (exit 2/3). For 429, a single retry after 20–60s is reasonable; persistent 429 means either rate-limit or (for the REST endpoint) insufficient balance — but the MCP endpoint used here is covered by the Coding Plan, so persistent 429 on MCP is a rate-limit, not a billing issue.
Limits and honest use
- Snippets are short and may truncate; do not over-claim what a page says from the snippet alone.
- The upstream domain filter is not always strict;
--domaintherefore applies a client-side hostname check (the requested domain and its subdomains are accepted). - Web search can return stale or SEO-heavy results — cross-check claims that matter.
- This is a discovery tool. Pair with
reference-searchfor citation-grade literature and with direct page reads (curl / a reader tool) when you need to quote.
References
references/protocol_notes.md— why MCP-not-REST, the streamable-HTTP handshake, SSE + multiply-escaped JSON parsing, and the gotchas that made this skill necessary.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

