Borrowing it
Nothing to install: this file belongs to shenjingnan/home-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/shenjingnan/home-mcp/main/.claude/commands/tool-create.mdgit clone --depth 1 https://github.com/shenjingnan/home-mcpWrote 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.
[](https://agentmods.dev/commands/shenjingnan/home-mcp/tool-create)<a href="https://agentmods.dev/commands/shenjingnan/home-mcp/tool-create"><img src="https://agentmods.dev/badge/commands/shenjingnan/home-mcp/tool-create/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/commands/shenjingnan/home-mcp/tool-create"><img src="https://agentmods.dev/badge/commands/shenjingnan/home-mcp/tool-create.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00005 | $0.01561 |
| Opus 5.5 | $0.00002 | $0.00624 |
| Sonnet 5.5 | $0.00001 | $0.00312 |
| Haiku 4.5 | $0.00001 | $0.00156 |
Grade A, and why
tool-create 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 2mo 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.
How it starts
The opening of the file, as written. The whole thing — 184 lines — stays where its author put it; the contents beside it link to each section on GitHub.
$1 $2
我需要在项目中创建一个新的MCP工具。请帮我完成完整的开发流程:
1. 分析需求
基于我提供的工具名称 <tool-name> 和描述 <tool-description>:
- 确定工具类型:属于哪种Home Assistant设备或服务控制
- 分析参数需求:确定输入参数的类型和验证规则
- 设计API接口:定义工具的方法签名和返回格式
2. 生成文件结构
创建以下标准文件:
src/
├── services/
│ └── {kebab-tool-name}.ts # 工具实现类
├── types/
│ └── {kebab-tool-name}.ts # 类型定义
└── test/
└── {kebab-tool-name}.test.ts # 测试文件
docs/content/mcp-tools/
└── {kebab-tool-name}.mdx # 工具文档
3. 服务类实现模式
基于现有 LightService 模式:
3.1 基础结构
import { Param, Tool } from "bestmcp";
import { z } from "zod";
import type { HassState, ServiceData } from "../types";
interface IHassService {
getStates(params?: { entity_id?: string }): Promise<HassState[]>;
callServices(params: { domain: string; service: string; service_data: Record<string, unknown> }): Promise<{
changed_states?: HassState[];
}>;
}
export class {ToolName}Service {
private static hassServiceInstance: IHassService | null = null;
public static setHassService(hassService: IHassService) {
{ToolName}Service.hassServiceInstance = hassService;
}
private getHassService(): IHassService {
if (!{ToolName}Service.hassServiceInstance) {
throw new Error("{ToolName}Service 未初始化,请先调用 setHassService()");
}
return {ToolName}Service.hassServiceInstance;
}
@Tool("{工具描述}")
public async {ToolName}(
// 参数定义...
) {
// 实现逻辑...
}
}
3.2 标准方法模式
- 设备查找:
getEntitiesByName()方法 - 参数验证:使用 Zod schema 进行严格类型检查
- 错误处理:统一的错误处理和用户友好的错误消息
- 状态更新:调用 Home Assistant 服务并返回结果
4. 类型定义标准
基于现有 types/light.ts 模式:
4.1 基础类型
- 参数类型:工具方法的输入参数接口
- 返回类型:工具方法的返回值接口
- 错误类型:自定义错误类和错误代码
- 配置类型:预设配置和常量定义
4.2 Home Assistant 集成
- 服务参数:
Hass{ToolName}ServiceParams接口 - 状态信息:
{ToolName}DeviceInfo接口 - 控制结果:
{ToolName}ControlResult接口
5. 测试文件模式
基于现有测试结构:
5.1 测试覆盖范围
- 参数验证测试:Zod schema 验证逻辑
- 服务调用测试:Home Assistant API 交互
- 错误处理测试:各种错误场景
- 边界条件测试:极值和异常输入
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.
- 2mo ago First seen · 184 lines · 0 tokens per session scan A f1b8294382f9
tool-create is a command published in the GitHub repository shenjingnan/home-mcp (23 stars, last pushed 9mo ago), licensed MIT. It adds 5 tokens to every session and 1,561 once invoked, about $0.0000 per session on Opus 5.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-30.
tool-create compared with commands from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| tool-createshenjingnan/home-mcp | Command | 23 | 9mo ago | MIT | A | 5 | Claude Code |
| checklistgithub/spec-kit | Command | 148k | yesterday | MIT | A | 13 | Claude Code |
| clarifygithub/spec-kit | Command | 148k | yesterday | MIT | A | 27 | Claude Code |
| specifygithub/spec-kit | Command | 148k | yesterday | MIT | A | 13 | Claude Code |
| analyzegithub/spec-kit | Command | 148k | yesterday | MIT | A | 26 | Claude Code |
| convergegithub/spec-kit | Command | 148k | yesterday | MIT | A | 35 | Claude Code |
| implementgithub/spec-kit | Command | 148k | yesterday | MIT | A | 14 | Claude Code |