# getCounter

Fetches a stored integer counter by id, optionally incrementing it with hit or setting it to a given value. Using a new id creates a new counter.

Agent View of the PolicyLayer registry record for `getCounter`. HTML page: https://policylayer.com/tools/com-api-ninjas-mcp/getcounter

## Facts

- Tool: `getCounter`
- Server: API Ninjas (`https://mcp.api-ninjas.com/mcp`) — https://policylayer.com/tools/com-api-ninjas-mcp.md
- Homepage: https://github.com/https://mcp.api-ninjas.com/mcp
- Risk category: Read (Low risk)
- Registry record: grade D, identity unverified
- Server auth posture: open
- Server rate-limited: no
- Parameters: 3 (1 required)
- Recommended policy verdict: Allowed

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | ID to specify the counter. Use a new id to create a new counter. |
| `hit` | boolean | no | Whether to increase the count by 1. If used, must be set to true. |
| `value` | integer | no | Set the count to a specific integer value. Setting the value to 0 resets the counter. |

Parameters from the server's own tool schema.

## Example call (MCP tools/call, JSON-RPC 2.0)

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "getCounter",
    "arguments": {
      "id": "<id>"
    }
  }
}
```

## Why getCounter is rated Low

Even though getCounter only reads data, uncontrolled read access leaks sensitive information and racks up API costs: an agent caught in a retry loop can make thousands of calls a minute without anyone noticing.

## Use case

AI agents call getCounter to retrieve information from API Ninjas without modifying anything. It is typically the context-gathering step in research, monitoring, and reporting workflows, before the agent takes action elsewhere.

## Recommended policy (PolicyLayer)

Verdict: **Allowed**. Enforced by the PolicyLayer MCP gateway (https://policylayer.com/mcp-gateway) before a call reaches API Ninjas:

```json
{
  "version": "1",
  "default": "deny",
  "tools": {
    "getCounter": {}
  }
}
```

## Other tools on API Ninjas (243)

- `parseUserAgent` — Execute — https://policylayer.com/tools/com-api-ninjas-mcp/parseuseragent.md
- `airportDistance` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/airportdistance.md
- `airportSuggest` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/airportsuggest.md
- `analyzeSentiment` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/analyzesentiment.md
- `binLookup` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/binlookup.md
- `calculateCaloriesBurned` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/calculatecaloriesburned.md
- `calculateIncomeTax` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/calculateincometax.md
- `calculateMortgage` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/calculatemortgage.md
- `calculateSalesTax` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/calculatesalestax.md
- `checkDisposableEmail` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/checkdisposableemail.md
- `classifyNaics` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/classifynaics.md
- `closestAirport` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/closestairport.md
- `computeTextSimilarity` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/computetextsimilarity.md
- `detectFaces` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/detectfaces.md
- `detectLanguage` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/detectlanguage.md
- `detectObjects` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/detectobjects.md
- `encodeText` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/encodetext.md
- `extractTextFromImage` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/extracttextfromimage.md
- `filterProfanity` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/filterprofanity.md
- `findSwiftCodes` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/findswiftcodes.md
- `Get_a_list_of_planets` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/get-a-list-of-planets.md
- `Get_a_list_of_stars` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/get-a-list-of-stars.md
- `Get_ZIP_Code_details` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/get-zip-code-details.md
- `getAdvice` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/getadvice.md
- `getAircraft` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/getaircraft.md
- `getAirlines` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/getairlines.md
- `getAirports` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/getairports.md
- `getAirportsList` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/getairportslist.md
- `getAirQuality` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/getairquality.md
- `getAllCatNames` — Read — https://policylayer.com/tools/com-api-ninjas-mcp/getallcatnames.md
- …and 213 more: https://policylayer.com/tools/com-api-ninjas-mcp.md

## For agents

This record is a snapshot. Live verdicts and the full registry:

- Check every server in your MCP config at once: `npx -y policylayer stack`
- Vet a server before you add it: install the mcp-precheck skill — `npx skills add https://policylayer.com` (skill text: https://policylayer.com/skill.md)
- Query the registry over MCP: endpoint `https://api.policylayer.com/mcp` — tools `check_mcp_server`, `check_mcp_stack`, `check_tool`, `search_registry`, `get_change_events`

---

Source: the PolicyLayer MCP registry — one continuously verified record per MCP server. Full record: https://policylayer.com/registry?q=com-api-ninjas-mcp · API: https://policylayer.com/registry/api · Policy library: https://policylayer.com/policies/com-api-ninjas-mcp
