KosmoKrator

data

Europe PMC Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the Europe PMC KosmoKrator integration.

Lua Namespace

Agents call this integration through app.integrations.europe_pmc.*. Use lua_read_doc("integrations.europe-pmc") 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 Europe PMC workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.europe_pmc.search({}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("europe-pmc"))' --json
kosmo integrations:lua --eval 'print(docs.read("europe-pmc.search"))' --json

Workflow file

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

workflow.lua
local europe_pmc = app.integrations.europe_pmc
local result = europe_pmc.search({})

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.europe_pmc, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.europe_pmc.default.* or app.integrations.europe_pmc.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Europe PMC, 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.

Europe PMC

Namespace: europe-pmc

Europe PMC provides public APIs for life-sciences publications, full-text XML, citations and references, database links, annotations, and GRIST grant data. No credentials are required.

Use europe_pmc_search for normal queries and europe_pmc_search_post for long queries.

local results = europe_pmc.search({
  query = 'TITLE:"large language model" AND OPEN_ACCESS:Y',
  resultType = "core",
  pageSize = 25,
  cursorMark = "*",
})

Common resultType values are idlist, lite, and core. format defaults to json; XML and Dublin Core are available where Europe PMC supports them.

Article Metadata

local article = europe_pmc.article({
  source = "MED",
  id = "28585529",
  resultType = "core",
})

Use source values from Europe PMC such as MED, PMC, AGR, or PAT.

local refs = europe_pmc.references({ source = "MED", id = "28585529" })
local cited_by = europe_pmc.citations({ source = "MED", id = "28585529" })
local db_links = europe_pmc.database_links({ source = "MED", id = "28585529" })
local scholix = europe_pmc.data_links({ source = "MED", id = "28585529" })

europe_pmc_labs_links returns external links supplied by third-party providers. europe_pmc_evaluations returns evaluations when Europe PMC has them for the article.

Full Text

local xml = europe_pmc.full_text_xml({ id = "PMC1664601" })

Full-text and book XML responses are parsed under xml. Supplementary files may return a zip/binary body, exposed as body with content_type.

Fields, Profiles, Metrics

local fields = europe_pmc.fields({})
local profile = europe_pmc.profile({ query = "malaria" })
local metrics = europe_pmc.metrics({})

Use fields to discover query fields before building advanced searches.

Annotations

local annotations = europe_pmc.annotations_by_article_ids({
  articleIds = { "MED:28585529", "PMC:PMC1664601" },
  type = "Chemicals",
})

Other annotation tools query by entity, provider, relationship, or section/type. europe_pmc_annotations_by_section_or_type requires at least section or type.

Grants

Use europe_pmc_grants_search for GRIST grant data.

local grants = europe_pmc.grants_search({
  query = 'ga:"Wellcome Trust" pi:smith',
  resultType = "core",
  page = 1,
})

GRIST fielded search examples include gid:083611, title:cancer, pi:smith, aff:Cambridge, and epmc_funders:yes.

Raw agent markdown
# Europe PMC

Namespace: `europe-pmc`

Europe PMC provides public APIs for life-sciences publications, full-text XML, citations and references, database links, annotations, and GRIST grant data. No credentials are required.

## Publication Search

Use `europe_pmc_search` for normal queries and `europe_pmc_search_post` for long queries.

```lua
local results = europe_pmc.search({
  query = 'TITLE:"large language model" AND OPEN_ACCESS:Y',
  resultType = "core",
  pageSize = 25,
  cursorMark = "*",
})
```

Common `resultType` values are `idlist`, `lite`, and `core`. `format` defaults to `json`; XML and Dublin Core are available where Europe PMC supports them.

## Article Metadata

```lua
local article = europe_pmc.article({
  source = "MED",
  id = "28585529",
  resultType = "core",
})
```

Use `source` values from Europe PMC such as `MED`, `PMC`, `AGR`, or `PAT`.

## Citation Network And Links

```lua
local refs = europe_pmc.references({ source = "MED", id = "28585529" })
local cited_by = europe_pmc.citations({ source = "MED", id = "28585529" })
local db_links = europe_pmc.database_links({ source = "MED", id = "28585529" })
local scholix = europe_pmc.data_links({ source = "MED", id = "28585529" })
```

`europe_pmc_labs_links` returns external links supplied by third-party providers. `europe_pmc_evaluations` returns evaluations when Europe PMC has them for the article.

## Full Text

```lua
local xml = europe_pmc.full_text_xml({ id = "PMC1664601" })
```

Full-text and book XML responses are parsed under `xml`. Supplementary files may return a zip/binary body, exposed as `body` with `content_type`.

## Fields, Profiles, Metrics

```lua
local fields = europe_pmc.fields({})
local profile = europe_pmc.profile({ query = "malaria" })
local metrics = europe_pmc.metrics({})
```

Use `fields` to discover query fields before building advanced searches.

## Annotations

```lua
local annotations = europe_pmc.annotations_by_article_ids({
  articleIds = { "MED:28585529", "PMC:PMC1664601" },
  type = "Chemicals",
})
```

Other annotation tools query by entity, provider, relationship, or section/type. `europe_pmc_annotations_by_section_or_type` requires at least `section` or `type`.

## Grants

Use `europe_pmc_grants_search` for GRIST grant data.

```lua
local grants = europe_pmc.grants_search({
  query = 'ga:"Wellcome Trust" pi:smith',
  resultType = "core",
  page = 1,
})
```

GRIST fielded search examples include `gid:083611`, `title:cancer`, `pi:smith`, `aff:Cambridge`, and `epmc_funders:yes`.
Metadata-derived Lua example
local result = app.integrations.europe_pmc.search({})
print(result)

Functions

search_post Read

Search Europe PMC publications with POST /searchPOST for long queries.

Lua path
app.integrations.europe_pmc.search_post
Full name
europe-pmc.europe_pmc_search_post
ParameterTypeRequiredDescription
No parameters.
article Read

Get one article by source and external ID.

Lua path
app.integrations.europe_pmc.article
Full name
europe-pmc.europe_pmc_article
ParameterTypeRequiredDescription
No parameters.
references Read

List publications referenced by an article.

Lua path
app.integrations.europe_pmc.references
Full name
europe-pmc.europe_pmc_references
ParameterTypeRequiredDescription
No parameters.
citations Read

List publications citing an article.

Lua path
app.integrations.europe_pmc.citations
Full name
europe-pmc.europe_pmc_citations
ParameterTypeRequiredDescription
No parameters.
evaluations Read

Get evaluations for an article.

Lua path
app.integrations.europe_pmc.evaluations
Full name
europe-pmc.europe_pmc_evaluations
ParameterTypeRequiredDescription
No parameters.
full_text_xml Read

Retrieve Open Access full-text XML by article ID.

Lua path
app.integrations.europe_pmc.full_text_xml
Full name
europe-pmc.europe_pmc_full_text_xml
ParameterTypeRequiredDescription
No parameters.
book_xml Read

Retrieve bookshelf XML by article ID.

Lua path
app.integrations.europe_pmc.book_xml
Full name
europe-pmc.europe_pmc_book_xml
ParameterTypeRequiredDescription
No parameters.
supplementary_files Read

Retrieve supplementary file archive for an article when available.

Lua path
app.integrations.europe_pmc.supplementary_files
Full name
europe-pmc.europe_pmc_supplementary_files
ParameterTypeRequiredDescription
No parameters.
fields Read

List indexed search fields.

Lua path
app.integrations.europe_pmc.fields
Full name
europe-pmc.europe_pmc_fields
ParameterTypeRequiredDescription
No parameters.
profile Read

Get result-count profiles by publication type and source.

Lua path
app.integrations.europe_pmc.profile
Full name
europe-pmc.europe_pmc_profile
ParameterTypeRequiredDescription
No parameters.
metrics Read

Read Europe PMC service metrics.

Lua path
app.integrations.europe_pmc.metrics
Full name
europe-pmc.europe_pmc_metrics
ParameterTypeRequiredDescription
No parameters.
annotations_by_articles Read

Get annotations for one or more article IDs.

Lua path
app.integrations.europe_pmc.annotations_by_articles
Full name
europe-pmc.europe_pmc_annotations_by_article_ids
ParameterTypeRequiredDescription
No parameters.
annotations_by_entity Read

Find annotations tagging a specific entity.

Lua path
app.integrations.europe_pmc.annotations_by_entity
Full name
europe-pmc.europe_pmc_annotations_by_entity
ParameterTypeRequiredDescription
No parameters.
annotations_by_provider Read

Find annotations supplied by a provider.

Lua path
app.integrations.europe_pmc.annotations_by_provider
Full name
europe-pmc.europe_pmc_annotations_by_provider
ParameterTypeRequiredDescription
No parameters.
annotations_by_relationship Read

Find relationship annotations between two entities.

Lua path
app.integrations.europe_pmc.annotations_by_relationship
Full name
europe-pmc.europe_pmc_annotations_by_relationship
ParameterTypeRequiredDescription
No parameters.
annotations_by_section_or_type Read

Find annotations by article section and/or annotation type.

Lua path
app.integrations.europe_pmc.annotations_by_section_or_type
Full name
europe-pmc.europe_pmc_annotations_by_section_or_type
ParameterTypeRequiredDescription
No parameters.