KosmoKrator

data

Semantic Scholar Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the Semantic Scholar KosmoKrator integration.

Lua Namespace

Agents call this integration through app.integrations.semantic_scholar.*. Use lua_read_doc("integrations.semantic-scholar") inside KosmoKrator to discover the same reference at runtime.

Call Lua from the Headless CLI

Use kosmo integrations:lua when a shell script, CI job, cron job, or another coding CLI should run a deterministic Semantic Scholar workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.semantic_scholar.search_papers({}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("semantic-scholar"))' --json
kosmo integrations:lua --eval 'print(docs.read("semantic-scholar.search_papers"))' --json

Workflow file

Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.

workflow.lua
local semantic_scholar = app.integrations.semantic_scholar
local result = semantic_scholar.search_papers({})

dump(result)
Run the workflow
kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json
Namespace note. integrations:lua exposes app.integrations.semantic_scholar, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.semantic_scholar.default.* or app.integrations.semantic_scholar.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Semantic Scholar, use the narrower mcp:lua command.

MCP Lua command
# Use mcp:lua for MCP-only scripts; use integrations:lua for this integration namespace.
kosmo mcp:lua --eval 'dump(mcp.servers())' --json

Agent-Facing Lua Docs

This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.

Semantic Scholar

Namespace: semantic_scholar

Semantic Scholar provides Academic Graph, Recommendations, and Datasets APIs for scholarly papers, authors, citations, snippets, recommendations, and dataset download metadata. All tools require a Semantic Scholar API key sent as x-api-key.

Academic Graph

Use paper search for relevance-ranked discovery and bulk search for larger result traversal.

local papers = semantic_scholar.search_papers({
  query = "retrieval augmented generation",
  limit = 10,
  fields = { "title", "year", "authors", "citationCount", "openAccessPdf" },
})

local paper = semantic_scholar.get_paper({
  paper_id = "CorpusId:216867622",
  fields = { "title", "abstract", "authors", "references", "citations" },
})

Paper graph traversal tools:

  • semantic_scholar_get_paper_authors
  • semantic_scholar_get_paper_citations
  • semantic_scholar_get_paper_references
  • semantic_scholar_batch_get_papers
  • semantic_scholar_autocomplete_papers
  • semantic_scholar_title_search_papers
  • semantic_scholar_search_snippets

Author tools:

  • semantic_scholar_search_authors
  • semantic_scholar_get_author
  • semantic_scholar_batch_get_authors
  • semantic_scholar_get_author_papers

Recommendations

local recommendations = semantic_scholar.recommend_papers({
  payload = {
    positivePaperIds = { "CorpusId:216867622" },
    negativePaperIds = {},
  },
  limit = 5,
  fields = { "title", "year", "authors" },
})

local similar = semantic_scholar.recommend_for_paper({
  paper_id = "CorpusId:216867622",
  limit = 5,
})

Datasets

The Datasets API returns release, dataset, and diff metadata plus download links. Dataset usage is governed by Semantic Scholar license terms.

local releases = semantic_scholar.list_dataset_releases({})

local dataset = semantic_scholar.get_dataset({
  release_id = "2026-01-01",
  dataset_name = "papers",
})

Return Shape

The integration returns Semantic Scholar JSON directly. Common response shapes include:

  • data arrays for search and paged graph endpoints
  • entity objects for singleton paper/author lookups
  • recommendation arrays for Recommendations API tools
  • release/dataset metadata and download links for Datasets API tools

Arrays in fields, publicationTypes, venue, fieldsOfStudy, paperIds, and similar parameters are sent as comma-separated values, matching the official API.

Raw agent markdown
# Semantic Scholar

Namespace: `semantic_scholar`

Semantic Scholar provides Academic Graph, Recommendations, and Datasets APIs for scholarly papers, authors, citations, snippets, recommendations, and dataset download metadata. All tools require a Semantic Scholar API key sent as `x-api-key`.

## Academic Graph

Use paper search for relevance-ranked discovery and bulk search for larger result traversal.

```lua
local papers = semantic_scholar.search_papers({
  query = "retrieval augmented generation",
  limit = 10,
  fields = { "title", "year", "authors", "citationCount", "openAccessPdf" },
})

local paper = semantic_scholar.get_paper({
  paper_id = "CorpusId:216867622",
  fields = { "title", "abstract", "authors", "references", "citations" },
})
```

Paper graph traversal tools:

- `semantic_scholar_get_paper_authors`
- `semantic_scholar_get_paper_citations`
- `semantic_scholar_get_paper_references`
- `semantic_scholar_batch_get_papers`
- `semantic_scholar_autocomplete_papers`
- `semantic_scholar_title_search_papers`
- `semantic_scholar_search_snippets`

Author tools:

- `semantic_scholar_search_authors`
- `semantic_scholar_get_author`
- `semantic_scholar_batch_get_authors`
- `semantic_scholar_get_author_papers`

## Recommendations

```lua
local recommendations = semantic_scholar.recommend_papers({
  payload = {
    positivePaperIds = { "CorpusId:216867622" },
    negativePaperIds = {},
  },
  limit = 5,
  fields = { "title", "year", "authors" },
})

local similar = semantic_scholar.recommend_for_paper({
  paper_id = "CorpusId:216867622",
  limit = 5,
})
```

## Datasets

The Datasets API returns release, dataset, and diff metadata plus download links. Dataset usage is governed by Semantic Scholar license terms.

```lua
local releases = semantic_scholar.list_dataset_releases({})

local dataset = semantic_scholar.get_dataset({
  release_id = "2026-01-01",
  dataset_name = "papers",
})
```

## Return Shape

The integration returns Semantic Scholar JSON directly. Common response shapes include:

- `data` arrays for search and paged graph endpoints
- entity objects for singleton paper/author lookups
- recommendation arrays for Recommendations API tools
- release/dataset metadata and download links for Datasets API tools

Arrays in `fields`, `publicationTypes`, `venue`, `fieldsOfStudy`, `paperIds`, and similar parameters are sent as comma-separated values, matching the official API.
Metadata-derived Lua example
local result = app.integrations.semantic_scholar.search_papers({})
print(result)

Functions

search_papers Read

Search papers by relevance.

Lua path
app.integrations.semantic_scholar.search_papers
Full name
semantic-scholar.semantic_scholar_search_papers
ParameterTypeRequiredDescription
No parameters.
bulk_search_papers Read

Bulk search papers with token paging.

Lua path
app.integrations.semantic_scholar.bulk_search_papers
Full name
semantic-scholar.semantic_scholar_bulk_search_papers
ParameterTypeRequiredDescription
No parameters.
title_search_papers Read

Search for papers by title.

Lua path
app.integrations.semantic_scholar.title_search_papers
Full name
semantic-scholar.semantic_scholar_title_search_papers
ParameterTypeRequiredDescription
No parameters.
autocomplete_papers Read

Suggest paper query completions.

Lua path
app.integrations.semantic_scholar.autocomplete_papers
Full name
semantic-scholar.semantic_scholar_autocomplete_papers
ParameterTypeRequiredDescription
No parameters.
get_paper Read

Get one paper by ID.

Lua path
app.integrations.semantic_scholar.get_paper
Full name
semantic-scholar.semantic_scholar_get_paper
ParameterTypeRequiredDescription
No parameters.
batch_get_papers Read

Get multiple papers by ID.

Lua path
app.integrations.semantic_scholar.batch_get_papers
Full name
semantic-scholar.semantic_scholar_batch_get_papers
ParameterTypeRequiredDescription
No parameters.
paper_authors Read

Get authors for a paper.

Lua path
app.integrations.semantic_scholar.paper_authors
Full name
semantic-scholar.semantic_scholar_get_paper_authors
ParameterTypeRequiredDescription
No parameters.
paper_citations Read

Get papers that cite a paper.

Lua path
app.integrations.semantic_scholar.paper_citations
Full name
semantic-scholar.semantic_scholar_get_paper_citations
ParameterTypeRequiredDescription
No parameters.
paper_references Read

Get papers referenced by a paper.

Lua path
app.integrations.semantic_scholar.paper_references
Full name
semantic-scholar.semantic_scholar_get_paper_references
ParameterTypeRequiredDescription
No parameters.
search_authors Read

Search authors by name.

Lua path
app.integrations.semantic_scholar.search_authors
Full name
semantic-scholar.semantic_scholar_search_authors
ParameterTypeRequiredDescription
No parameters.
get_author Read

Get one author by ID.

Lua path
app.integrations.semantic_scholar.get_author
Full name
semantic-scholar.semantic_scholar_get_author
ParameterTypeRequiredDescription
No parameters.
batch_get_authors Read

Get multiple authors by ID.

Lua path
app.integrations.semantic_scholar.batch_get_authors
Full name
semantic-scholar.semantic_scholar_batch_get_authors
ParameterTypeRequiredDescription
No parameters.
author_papers Read

Get papers by an author.

Lua path
app.integrations.semantic_scholar.author_papers
Full name
semantic-scholar.semantic_scholar_get_author_papers
ParameterTypeRequiredDescription
No parameters.
search_snippets Read

Search paper text snippets.

Lua path
app.integrations.semantic_scholar.search_snippets
Full name
semantic-scholar.semantic_scholar_search_snippets
ParameterTypeRequiredDescription
No parameters.
recommend_papers Read

Recommend papers from positive and negative seeds.

Lua path
app.integrations.semantic_scholar.recommend_papers
Full name
semantic-scholar.semantic_scholar_recommend_papers
ParameterTypeRequiredDescription
No parameters.
recommend_paper Read

Recommend papers for one paper.

Lua path
app.integrations.semantic_scholar.recommend_paper
Full name
semantic-scholar.semantic_scholar_recommend_for_paper
ParameterTypeRequiredDescription
No parameters.
list_dataset_releases Read

List available dataset releases.

Lua path
app.integrations.semantic_scholar.list_dataset_releases
Full name
semantic-scholar.semantic_scholar_list_dataset_releases
ParameterTypeRequiredDescription
No parameters.
get_dataset_release Read

List datasets in a release.

Lua path
app.integrations.semantic_scholar.get_dataset_release
Full name
semantic-scholar.semantic_scholar_get_dataset_release
ParameterTypeRequiredDescription
No parameters.
get_dataset Read

Get dataset download links.

Lua path
app.integrations.semantic_scholar.get_dataset
Full name
semantic-scholar.semantic_scholar_get_dataset
ParameterTypeRequiredDescription
No parameters.
get_dataset_diffs Read

Get incremental diff download links.

Lua path
app.integrations.semantic_scholar.get_dataset_diffs
Full name
semantic-scholar.semantic_scholar_get_dataset_diffs
ParameterTypeRequiredDescription
No parameters.