Fetch segment rows
firmafakta_fetchFetch a segment's rows: a page of them in the answer, or with format a file of them. A segment is an expression in describe's segment language, which has examples. Pass segment and per, which is required with segment (workplace: a row per workplace; company: a row per company, its main workplace; email: a row per e-mail address of each company, every address where a company row gives the first three), and optionally limit, fields, sort; or only next from the previous page to continue. Without fields each row has describe's short_fields; name others from describe's result_fields in fields, or use firmafakta_lookup for everything on one company. Each row costs credits; a nightly update between pages may shift rows. Without limit a page is 10 rows, costing 10 credits; at most 1000. With format (csv or xlsx) the answer is a link to a file of the rows instead of the rows: use it for more rows than you would read, or a list the user keeps; without fields the file has every field the plan reaches. A file holds at most 5000 rows, and without limit what the credits buy; a larger segment comes in parts, the next part a file again with next. The link works for one download within 24 hours: give it to the user, and open it yourself only to work on the file, since opening it uses it up. random draws limit rows at random from the segment, in rows or in a file, as one page.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "firmafakta_fetch"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| per | No | required with segment: workplace (a row per workplace), company (a row per company, its main workplace) or email (a row per e-mail address of each company: the address, its kind and sources after org number and name, then any fields); a page continued with next keeps its per | |
| next | No | the next value of the previous page, alone, to continue | |
| sort | No | a field from describe's sort_fields, optionally followed by asc or desc | |
| limit | No | rows in this page, at one credit a row; describe's limits give the default and the maximum | |
| fields | No | returned fields to include, from describe's result_fields; omitted gives its short_fields | |
| format | No | csv or xlsx: answer with a link to a file of the segment's rows instead of rows, a part of at most describe's file_max rows; next from its answer gives the next part as a file | |
| random | No | draw limit rows at random from the segment instead of in order; not with sort or next | |
| segment | No | the segment expression; omit when passing next |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | ||
| next | No | ||
| rows | No | ||
| total | No | ||
| usage | No | ||
| locked | No | ||
| readback | No |