agentleFS
AxectAxect/skills/zai-web-search/SKILL.md

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.

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
  1. Distinctive:

    If either fails, tell the user:

    line 42
  2. Very specific:

    Do not create a second credential file.

    line 45
  3. Very specific:

    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 …

    line 75

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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:

SkillSourcesBest forOutput shape
reference-searchInspireHEP / OpenAlex / Semantic Scholar APIsAcademic papers, metadata, BibTeX, abstracts, citation context, baselinesMarkdown-ready citations with quoted match sentences
zai-web-search (this)Live web via z.ai search-primeRecent 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/null

If either fails, tell the user:

The z.ai key is not configured in ~/.pi/agent/auth.json under zai-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-search or bibtex-gen with the arXiv ID / DOI.

Error handling

Exit codeMeaningAction
0successuse the printed results
1bad argument (query empty / too long)fix the call
2auth.json missing or no zai-coding-cn.keyuser must (re-)configure pi login
3auth rejected (HTTP 401 / MCP -401)key invalid or expired → re-login via pi
4search-side error (429, 5xx, MCP error)surface the message; retry once after a short wait for transient 429
5network or parse failuretransient HTTP/TLS failures are retried twice; then show stderr and check connectivity
64usage errorshow --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; --domain therefore 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-search for 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.