count-files

count-files is a command for Claude Code from thhart/fd-mcp. It costs 8 tokens per session (112 once invoked), scanned A, original, MIT.

A command for counting project files by type with fd-mcp, a tool for finding files while respecting ignore rules such as .gitignore.

In plain words
What is it for?
Counting Python, JavaScript, or other file types, as well as all files or directories in a project.
Why use it?
It provides accurate file counts without manually searching through ignored or unrelated files.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/thhart/fd-mcp/count-files
Clone the repo
git clone --depth 1 https://github.com/thhart/fd-mcp

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for count-files

README.md
[![agentmods](https://agentmods.dev/badge/commands/thhart/fd-mcp/count-files.svg)](https://agentmods.dev/commands/thhart/fd-mcp/count-files)
Your own site
<a href="https://agentmods.dev/commands/thhart/fd-mcp/count-files"><img src="https://agentmods.dev/badge/commands/thhart/fd-mcp/count-files.svg" alt="Measured on agentmods" height="20"></a>
Per session 8 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 112 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00008 $0.00112
Opus 5 $0.00004 $0.00056
Sonnet 5 $0.00002 $0.00022
Haiku 4.5 $0.00001 $0.00011

Measured 3d ago against content hash 6d6e62805e23, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

count-files scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/count-files.md · 15 lines

What it actually says

Count files in the project by type using mcp__fd__fd_count.

Ask the user what type of files they want to count (e.g., Python, JavaScript, all files).

Then use mcp__fd__fd_count with appropriate parameters:

  • extension="py" for Python files
  • type="f" for all files
  • type="d" for all directories

This is faster than find | wc -l and gives accurate counts respecting .gitignore by default.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 15 lines · 8 tokens per session scan A 6d6e62805e23

Subscribe to this mod's changes

count-files is a command published in the GitHub repository thhart/fd-mcp (1 stars, last pushed 9mo ago), licensed MIT. It adds 8 tokens to every session and 112 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.