Skip to main content
Glama

Count a segment

firmafakta_count
Read-only

How many companies or workplaces match a segment, with the segment read back in words so the user can check it was understood. Count before you fetch: it costs one flat price (see describe's prices) however large the segment, while fetch charges per row. per says what is counted: workplace counts every workplace, company each company once, email each company's e-mail addresses.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "segment": "<segment>",
      "per": "<per>"
    },
    "name": "firmafakta_count"
  }
}

Input Schema

NameRequiredDescriptionDefault
perYesrequired: workplace counts every workplace, company counts each company once (by its main workplace), email counts the companies' e-mail addresses, the rows a fetch per email gives
segmentYesthe segment expression in describe's segment language; describe has examples

Output Schema

NameRequiredDescriptionDefault
unitNo
countNo
usageNo
readbackNo
sole_proprietorshipsNodeprecated, always 0: sole proprietorships are not counted; kept for clients that cached the earlier schema

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / per / description
      Previous value: -"required: workplace counts every workplace, company counts each company once (by its main workplace)"New value: +"required: workplace counts every workplace, company counts each company once (by its main workplace), email counts the companies' e-mail addresses, the rows a fetch per email gives"
    • changedInput schema / properties / per / enum
      Previous value: -[
      -  "workplace",
      -  "company"
      -]New value: +[
      +  "workplace",
      +  "company",
      +  "email"
      +]
  2. Changed32 schema fields changed
    • removedOutput schema / properties / account_offer
      Removed value: -{
      -  "description": "on the server without an account: what a free account gives for fetching this segment's list; tell the user when they want the list",
      -  "type": "string"
      -}
    • addedOutput schema / properties / count / title
      Added value: +"count"
    • removedOutput schema / properties / count / type
      Removed value: -"integer"
    • addedOutput schema / properties / readback / title
      Added value: +"readback"
    • removedOutput schema / properties / readback / type
      Removed value: -"string"
    • removedOutput schema / properties / sole_proprietorships / type
      Removed value: -"integer"
    • addedOutput schema / properties / unit / title
      Added value: +"unit"
    • removedOutput schema / properties / unit / type
      Removed value: -"string"
    • removedOutput schema / properties / usage / properties / credits_charged / maximum
      Removed value: -2147483647
    • removedOutput schema / properties / usage / properties / credits_charged / minimum
      Removed value: --2147483648
    • addedOutput schema / properties / usage / properties / credits_charged / title
      Added value: +"credits_charged"
    • removedOutput schema / properties / usage / properties / credits_charged / type
      Removed value: -"integer"
    • removedOutput schema / properties / usage / properties / credits_left / maximum
      Removed value: -2147483647
    • removedOutput schema / properties / usage / properties / credits_left / minimum
      Removed value: --2147483648
    • addedOutput schema / properties / usage / properties / credits_left / title
      Added value: +"credits_left"
    • removedOutput schema / properties / usage / properties / credits_left / type
      Removed value: -[
      -  "null",
      -  "integer"
      -]
    • removedOutput schema / properties / usage / properties / offer
      Removed value: -{
      -  "type": "string"
      -}
    • addedOutput schema / properties / usage / properties / plan / title
      Added value: +"plan"
    • removedOutput schema / properties / usage / properties / plan / type
      Removed value: -"string"
    • addedOutput schema / properties / usage / properties / refills_on / title
      Added value: +"refills_on"
    • removedOutput schema / properties / usage / properties / refills_on / type
      Removed value: -"string"
    • addedOutput schema / properties / usage / properties / throttled / properties / plan / title
      Added value: +"plan"
    • removedOutput schema / properties / usage / properties / throttled / properties / plan / type
      Removed value: -"string"
    • addedOutput schema / properties / usage / properties / throttled / properties / waited_ms / title
      Added value: +"waited_ms"
    • removedOutput schema / properties / usage / properties / throttled / properties / waited_ms / type
      Removed value: -"integer"
    • removedOutput schema / properties / usage / properties / throttled / required
      Removed value: -[
      -  "waited_ms",
      -  "plan"
      -]
    • addedOutput schema / properties / usage / properties / throttled / title
      Added value: +"throttled"
    • removedOutput schema / properties / usage / properties / throttled / type
      Removed value: -[
      -  "null",
      -  "object"
      -]
    • removedOutput schema / properties / usage / required
      Removed value: -[
      -  "plan",
      -  "credits_charged"
      -]
    • addedOutput schema / properties / usage / title
      Added value: +"usage"
    • removedOutput schema / properties / usage / type
      Removed value: -"object"
    • removedOutput schema / required
      Removed value: -[
      -  "count",
      -  "unit",
      -  "readback",
      -  "usage",
      -  "sole_proprietorships"
      -]
  3. Changed2 schema fields changed
    • changedInput schema / properties / per / description
      Previous value: -"required: workplace (a row per workplace) or company (a row per company, its main workplace)"New value: +"required: workplace counts every workplace, company counts each company once (by its main workplace)"
    • changedInput schema / properties / segment / description
      Previous value: -"the segment expression; see firmafakta_describe"New value: +"the segment expression in describe's segment language; describe has examples"
  4. Changed5 schema fields changed
    • removedOutput schema / additionalProperties
      Removed value: -false
    • addedOutput schema / properties / account_offer
      Added value: +{
      +  "description": "on the server without an account: what a free account gives for fetching this segment's list; tell the user when they want the list",
      +  "type": "string"
      +}
    • removedOutput schema / properties / usage / additionalProperties
      Removed value: -false
    • addedOutput schema / properties / usage / properties / offer
      Added value: +{
      +  "type": "string"
      +}
    • removedOutput schema / properties / usage / properties / throttled / additionalProperties
      Removed value: -false
  5. Changed2 schema fields changed
    • addedOutput schema / properties / sole_proprietorships / description
      Added value: +"deprecated, always 0: sole proprietorships are not counted; kept for clients that cached the earlier schema"
    • changedOutput schema / required
      Previous value: -[
      -  "count",
      -  "sole_proprietorships",
      -  "unit",
      -  "readback",
      -  "usage"
      -]New value: +[
      +  "count",
      +  "unit",
      +  "readback",
      +  "usage",
      +  "sole_proprietorships"
      +]
  6. First observed

TDQS

A4.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare a read-only, non-destructive operation, so the safety profile is covered. The description usefully adds the flat-pricing model and the segment read-back, but says nothing about invalid-segment handling or result shape. Note the annotations set idempotentHint=false for what is described as a pure count — the description neither confirms nor contradicts this, so no contradiction is flagged, but it leaves the agent without a clear idempotency story.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the answer, then the cost argument, then the parameter note — a sensible ordering with little waste. The 'per' explanation duplicates the enum text in the schema, which is the one redundant stretch.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return-value shape need not be spelled out, and the description covers cost tradeoffs, the alternative tool, and counting semantics. Only edge behavior (malformed segment, empty result) is unaddressed, which is minor for a two-parameter read tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so both parameters are already documented, including the enum values for 'per'. The description restates the 'per' semantics in plainer language with a useful cross-reference to fetch-per-email, but adds no syntax or format detail the schema lacks. Baseline 3 applies when the schema carries the burden.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The first clause states a concrete verb and resource ('How many companies or workplaces match a segment') and adds the read-back behavior. It is immediately distinguishable from firmafakta_fetch, which it explicitly contrasts as the per-row alternative.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

'Count before you fetch' states the selection rule directly and names the sibling tool that is the alternative. It also gives the reason (flat price vs. per-row charge), which lets an agent decide without guessing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.