mcpField
S
semantic-scholar

semantic-scholar

github.com/allenai生产力43261 次安装今天更新
代码仓库

关于 semantic-scholar

通过 `asta papers` 调用 Semantic Scholar API,进行定向论文与作者查询。适合需要元数据、引用关系、关键词结果或全文片段的研究任务,不用于全面文献综述。

主要功能

  1. 01按 ID 获取论文元数据
  2. 02按关键词和日期搜索论文
  3. 03搜索全文片段
  4. 04获取引用某论文的作品
  5. 05查找作者及其论文

适用场景

  1. 01查看论文作者、发表 venue 或引用数
  2. 02追踪引用指定论文的作品
  3. 03查找某位作者的发表论文
  4. 04定位匹配某项主张或方法的段落

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/allenai/asta-plugins --skill semantic-scholar

安装后在 Claude Code 中输入/semantic-scholar确认已加载。

详细介绍

Semantic Scholar 查询

通过 `asta papers` 命令调用 Semantic Scholar API,快速、精准地查询论文元数据、引用和作者。

何时使用此技能

  • 用户询问某篇特定论文的详细信息(按标题、DOI、arXiv ID 等)
  • 用户想查看引用某篇作品的论文
  • 用户询问某位作者的论文
  • 用户想快速按关键词搜索(而非生成综合报告)
  • 用户想在论文全文中查找特定主张、方法或证据(使用 snippet-search)
  • 任务需要精准查询论文元数据或引用图谱

不适用于生成综合报告——请改用 Literature Report Generation 技能。

相关技能:Find Literature

asta papers ...(此技能)用于通过 Semantic Scholar API 机械式地精准查询:获取已知论文、列出引用、按标题/摘要/正文中的关键词搜索,以及查询作者。除 S2 自身的关键词排序外,不涉及 Agent 推理。

Find Literature 技能(asta literature find / asta literature interactive)用于以主题为导向、基于标准的搜索:系统从查询中提取相关性标准,检索候选结果,并根据这些标准对结果进行排序,同时提供逐篇相关性摘要——更接近“依据分级判断进行文献搜索”,而非关键词匹配。

以下情况使用此技能(asta papers):

  • 用户指定了要查询的特定论文、作者、ID 或确切短语
  • 需要原始元数据(引用、发表场所、研究领域、openAccessInfo)
  • 正在浏览引用图谱(谁引用了什么、某位作者引用了谁)
  • 想在论文正文中搜索特定字符串(snippet-search)
  • 需要快速获取结果,且不要求全面覆盖

以下情况改用 Find Literature 技能:

  • 用户提出“查找关于 X 的论文”“文献对 Y 有何看法”“支持 Z 观点的论文”等请求
  • 查询内容是研究主题,而非字符串匹配;且需要相关性排序及解释
  • 工作会话具有探索性:筛选先前结果、汇总信息、跨多轮追踪关联(使用 asta literature interactive --thread-dir <dir>)
  • 相较于原始关键词搜索,通过 find 式单次查询或 interactive 式多轮 Agent 循环并进行验证,能获得排序更优的结果

两者互为补充。一种常见流程是:先使用 Find Literature 发掘某个主题的相关论文,再使用 asta papers get / asta papers citations 深入查询具体论文。

**会话级经验法则:**如果整个会话都围绕文献搜索/探索展开(例如用户的第一轮请求是“查找关于 X 的论文”),则默认使用 asta literature interactive 开展探索,即使单个查询看起来很简单。如果会话主题另有侧重,只是将快速查询元数据或引用作为其中一个步骤,则使用 asta papers。

可用命令

获取论文详情

asta papers get - 按 ID 获取单篇论文的元数据

asta papers get ARXIV:2005.14165

asta papers get "DOI:10.18653/v1/N18-3011" --fields title,year,authors,abstract

asta papers get CorpusId:215416146 --format text

支持的 ID 格式:

  • ARXIV:2106.15928
  • DOI:10.18653/v1/N18-3011
  • CorpusId:215416146
  • PMID:19872477
  • URL:https://arxiv.org/abs/2106.15928

常见字段:title,abstract,authors,year,venue,citationCount,publicationDate,url,isOpenAccess,fieldsOfStudy

搜索论文

asta papers search - 按关键词搜索论文

asta papers search "transformers attention mechanism"

asta papers search "RLHF" --date 2023- --limit 10

asta papers search "neural networks" --fields title,year,abstract,authors

asta papers search "LLM safety" --date 2024-01-01:2024-12-31

选项:

  • --fields:以逗号分隔的待返回字段
  • --limit:结果数量(默认值为 20,最大值为 100)
  • --date:发表日期或年份筛选条件。接受年份(2020、2020-2024、2020-)或日期范围(2024-01-01:2024-12-31)。映射到 S2 的 publicationDateOrYear 参数。
  • --format:将输出格式设为 json 或 text
片段搜索

asta papers snippet-search - 通过 S2 snippet/search API 搜索论文全文(标题、摘要和正文)。返回匹配的文本摘录以及论文元数据。

asta papers snippet-search "in-context learning emerges at scale"

asta papers snippet-search "RLHF reward hacking" --date 2023- --limit 10

asta papers snippet-search "sparse mixture of experts" --fields snippet.text,snippet.snippetKind,snippet.section

# Pin results to papers indexed before a date (useful for reproducible benchmarks)
asta papers snippet-search "chain-of-thought" --inserted-before 2024-01-01

--fields 选项接受片段字段:

  • snippet.text - 匹配的文本摘录(约 500 个单词)
  • snippet.snippetKind - 来源类型(例如标题、摘要、正文)
  • snippet.section - 片段所在的论文部分
  • snippet.snippetOffset - 字符位置信息(start、end)
  • snippet.annotations - 标记内容,包括参考文献提及和句子边界

如果省略 --fields,默认值为 snippet.text,snippet.snippetKind。无论是否指定 --fields,始终都会返回论文元数据(corpusId、标题、作者、openAccessInfo)和相关性得分。

选项:

  • --fields:要返回的逗号分隔片段字段
  • --date:日期/年份筛选,与标准搜索相同
  • --limit:最大结果数(默认 20,最多 1000,上限高于标准搜索)
  • --inserted-before:仅包含在此日期前编入索引的论文(YYYY-MM-DD、YYYY-MM 或 YYYY)。通常用于确保基准测试结果一致:固定截止日期可确保多次运行返回相同的论文集合,即使系统持续编入新论文也是如此。
  • --format:以 json 或 text 格式输出
获取引用

asta papers citations - 获取引用指定作品的论文

asta papers citations ARXIV:2005.14165

asta papers citations CorpusId:218487638 --limit 20 --format text

选项:

  • --fields:引用论文的字段
  • --limit:最大结果数(默认 50,最多 1000)
  • --format:以 json 或 text 格式输出
作者搜索与论文

asta papers author search - 按姓名查找作者

asta papers author search "Yoav Goldberg"

asta papers author search "Hinton" --limit 5 --format text

asta papers author papers - 获取某位作者的论文

# First, get author ID from search
asta papers author search "Yoav Goldberg"

# Then get their papers using the author ID
asta papers author papers 1741101 --limit 50

asta papers author papers 1741101 --fields title,year,venue,citationCount

选项:

  • --fields:要返回的论文字段
  • --limit:最大结果数(默认 50,最多 1000)
  • --format:以 json 或 text 格式输出

输出格式

所有命令都支持两种输出格式:

JSON 格式(默认):

  • 机器可读
  • 完整的数据结构
  • 可通过管道传递给 jq 进行筛选
  • 最适合编程使用

文本格式(--format text):

  • 易于阅读
  • 格式化输出
  • 最适合快速浏览
  • 向用户展示结果时使用

使用技巧

高效选择字段

只请求所需字段,以加快响应速度:

# Good - minimal fields for quick browse
asta papers search "deep learning" --fields title,year,authors,citationCount

# Less efficient - many fields slow down response
asta papers search "deep learning" --fields title,abstract,authors,year,venue,citations,references
日期筛选

适当限定为近期论文:

asta papers search "RLHF" --date 2023-2024  # 2023-2024
asta papers search "RLHF" --date 2023-      # 2023 onwards
asta papers search "RLHF" --date -2020      # Before 2020
asta papers search "RLHF" --date 2024-06-01:2024-12-31  # Specific date range
通过管道传递给 jq

用于复杂的 JSON 处理:

# Extract just titles
asta papers search "transformers" | jq '.data[].title'

# Filter by citation count
asta papers search "neural networks" | jq '.data[] | select(.citationCount > 100)'

# Get author names
asta papers get ARXIV:2005.14165 | jq '.authors[].name'
多步工作流

串联命令以处理复杂查询:

示例 1:查找某位作者近期被引用次数较多的论文

# 1. Find author
asta papers author search "Geoffrey Hinton" --format text

# 2. Get their recent papers
asta papers author papers 1751273 --fields title,year,citationCount --limit 50 | \
  jq '.data[].paper | select(.year >= 2020) | select(.citationCount > 100)'

示例 2:探索引用网络

# 1. Get paper details
asta papers get ARXIV:2005.14165

# 2. Get who cited it
asta papers citations ARXIV:2005.14165 --limit 20 --format text

# 3. Get details on specific citing papers
asta papers get CorpusId:123456789

工作流示例

“获取 arXiv:2005.14165 的详细信息”
asta papers get ARXIV:2005.14165 --format text

以易于阅读的格式向用户展示输出。

“哪些论文引用了 GPT-3 论文?”
# GPT-3 paper
asta papers citations ARXIV:2005.14165 --limit 50 --format text

展示结果中近期或被引用次数较多的论文。

“RLHF 相关的近期论文”
asta papers search "RLHF reinforcement learning from human feedback" \
  --date 2023- \
  --limit 20 \
  --fields title,abstract,year,authors,venue,citationCount \
  --format text
“Yoav Goldberg 撰写的论文”
# Step 1: Find author
asta papers author search "Yoav Goldberg" --format text

# Step 2: Get their papers (using author ID from step 1)
asta papers author papers 1741101 \
  --fields title,year,venue,citationCount \
  --limit 50 \
  --format text
“查找‘chain-of-thought’推理的证据”
# Snippet search finds mentions in paper bodies, not just titles/abstracts
asta papers snippet-search "chain-of-thought reasoning improves performance" \
  --limit 15

# Or use standard search for paper-level results
asta papers search "chain-of-thought reasoning" \
  --fields title,abstract,year,authors \
  --limit 15

# Then examine specific papers with 'asta papers get'

结果展示

向用户展示结果时:

单篇论文:

**Title** (Year)
Authors: [author list]
Venue: [venue name]
Citations: [count]

[Abstract]

URL: [Semantic Scholar link]

论文列表:

Found [N] papers:

1. **Paper Title** - Author et al. (Year) - [Venue] - [X citations]
2. **Another Paper** - ...
...

片段结果(snippet-search):

Found [N] snippet results:

1. **Paper Title** - Author et al.
   Score: 0.95
   Snippet (abstract): "...matching text excerpt..."
2. **Another Paper** - ...
...

引用:

Found [N] papers citing this work:

Recent citations:
1. [Paper 1] (2024) - [citations]
2. [Paper 2] (2023) - [citations]
...

最佳实践

  • 直接向用户展示结果时,使用 --format text
  • 需要处理或筛选结果时,使用 JSON 输出
  • 从较小的结果数限制开始,必要时再调高
  • 只获取实际会用到的字段
  • 搜索论文正文中的特定论断、方法或证据时,使用 snippet-search
  • 按主题发现论文时,使用 search
  • 进行全面研究时,建议使用 Literature Report Generation 技能
  • 适时提供 Semantic Scholar URL:请求并使用 url 字段,或者根据已有的 ID 构建链接——对于 paperId,使用 https://www.semanticscholar.org/paper/<paperId>;对于 corpus ID,使用 https://api.semanticscholar.org/CorpusID:<corpusId>

API 密钥

如果存在 ASTA_TOOL_KEY 环境变量,命令会使用它。大多数查询无需密钥即可使用,但使用密钥可以获得更高的速率限制。

评论

支持 Markdown