fix-mypy

fix-mypy is a command for Claude Code from vishnu2kmohan/mcp-server-langgraph. It costs 15 tokens per session (2,196 once invoked), scanned A, original, MIT.

A guided workflow for finding and correcting MyPy errors. MyPy checks Python code for type mistakes before it runs.

In plain words
What is it for?
Use it to run MyPy on the whole project or one module, save the errors, and fix missing annotations and incompatible types.
Why use it?
It turns a large list of type-checking errors into a repeatable process and supports the goal of re-enabling strict checking.

Command for Claude Code

Written for Claude Code: installed under .claude/.

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/vishnu2kmohan/mcp-server-langgraph/fix-mypy
Clone the repo
git clone --depth 1 https://github.com/vishnu2kmohan/mcp-server-langgraph

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 fix-mypy

README.md
[![agentmods](https://agentmods.dev/badge/commands/vishnu2kmohan/mcp-server-langgraph/fix-mypy.svg)](https://agentmods.dev/commands/vishnu2kmohan/mcp-server-langgraph/fix-mypy)
Your own site
<a href="https://agentmods.dev/commands/vishnu2kmohan/mcp-server-langgraph/fix-mypy"><img src="https://agentmods.dev/badge/commands/vishnu2kmohan/mcp-server-langgraph/fix-mypy.svg" alt="Measured on agentmods" height="20"></a>
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,196 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.1 $0.00015 $0.02196
Opus 5 $0.00008 $0.01098
Sonnet 5 $0.00003 $0.00439
Haiku 4.5 $0.00002 $0.00220

Measured 5d ago against content hash aff50475d736, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

fix-mypy 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 5d 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/fix-mypy.md · 369 lines

How it starts

The opening of the file, as written. The whole thing — 369 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Fix MyPy Type Errors

Systematic workflow for fixing MyPy type checking errors in the codebase.

Usage

/fix-mypy

Current Status

  • MyPy: Currently DISABLED in pre-commit due to 145+ errors
  • Goal: Fix all errors to enable strict type checking
  • Target: 0 errors (100% type safety)
  • Checklist: See .github/checklists/TYPE_SAFETY_MIGRATION.md

Quick Start

Run MyPy to See Errors

mypy src/ --show-error-codes

Run on Specific Module

mypy src/mcp_server_langgraph/core/config.py

Save Errors to File

mypy src/ --show-error-codes > mypy_errors.txt

Common Error Types & Fixes

1. Missing Return Type Annotation

Error: error: Function is missing a return type annotation

# ❌ Before
def get_user(user_id: str):
    return user_service.get(user_id)

# ✅ After
def get_user(user_id: str) -> User | None:
    return user_service.get(user_id)

2. Missing Type Hints for Function Arguments

Error: error: Function is missing a type annotation for one or more arguments

# ❌ Before
def process_data(data):
    return data.upper()

# ✅ After
def process_data(data: str) -> str:
    return data.upper()

3. Incompatible Types in Assignment

Error: error: Incompatible types in assignment (expression has type "X", variable has type "Y")

# ❌ Before
result: int = get_value()  # get_value() returns str

# ✅ After - Option 1: Fix type hint
result: str = get_value()

# ✅ After - Option 2: Convert type
result: int = int(get_value())

4. Optional Not Handled

Error: error: Item "None" of "Optional[X]" has no attribute "Y"

# ❌ Before
config = get_config()  # Returns Optional[Config]
value = config.get("key")  # MyPy error

# ✅ After
config = get_config()
if config is not None:
    value = config.get("key")

5. Argument Type Mismatch

Error: error: Argument 1 has incompatible type "X"; expected "Y"

# ❌ Before
def process(data: dict) -> None:
    ...

process([1, 2, 3])  # Passing list instead of dict

# ✅ After
process({"key": "value"})  # Pass correct type

Read the full file on GitHub · 369 lines

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. 5d ago First seen · 369 lines · 15 tokens per session scan A aff50475d736

Subscribe to this mod's changes

fix-mypy is a command published in the GitHub repository vishnu2kmohan/mcp-server-langgraph (4 stars, last pushed 5d ago), licensed MIT. It adds 15 tokens to every session and 2,196 once invoked, about $0.0001 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.