Agent Skills
› zzatpku/AgentFactory
› local_search
local_search
GitHub在本地知识库中搜索相关文档,返回包含相关性分数的截断文本片段。适用于信息检索场景,需配合open_page获取完整内容。
Trigger Scenarios
用户需要查询本地知识库中的文档信息
需要根据关键词检索相关文档片段
Install
npx skills add zzatpku/AgentFactory --skill local_search -g -y
SKILL.md
Frontmatter
{
"name": "local_search",
"description": "Search for relevant documents in the local knowledge base. Returns incomplete\/truncated text snippets with relevance scores. Use open_page to get full document content."
}
Search Tool
Search for documents matching a query in the local knowledge base.
Usage
from tools import local_search
results = local_search(query, topk=10)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| query | str | required | The search query string |
| topk | int | 10 | Number of top results to return |
Returns
{
"results": [
{
"docid": "document_id_string",
"url": "https://example.com/page",
"text": "incomplete/truncated document snippet...",
"score": 0.95
},
...
],
"took_ms": 12.5
}
Or on error:
{"error": "error message"}
Note: The text field returned by local_search contains incomplete/truncated content, NOT the full document. It may cut off at arbitrary points, causing you to miss critical information. Always use open_page to retrieve the full document content for any result that is relevant to your query.
Example
from tools import local_search
# local_search for information about a topic
results = local_search("capital of France", topk=3)
# Process results
for doc in results.get("results", []):
print(f"DocID: {doc['docid']}")
print(f"Score: {doc['score']}")
print(f"Text: {doc['text'][:200]}...")
print("---")
Tips
- Use specific, descriptive queries for better results
- Start with topk around 10 and adjust if needed
- Check the score to gauge relevance
- The
textfield fromlocal_searchis incomplete/truncated - it may cut off mid-sentence at arbitrary points - Always use
open_pageto get the full document content for any relevant result - do NOT rely solely on the truncated text fromlocal_search - When using
open_page, remember the text is inresults[0]["text"], not at the top level
Version History
- df92287 Current 2026-07-25 08:38


