Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/Matt-Dionis/claude-code-configsnpx agentmods add commands/matt-dionis/claude-code-configs/add-toolWrote 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/matt-dionis/claude-code-configs/add-tool)<a href="https://agentmods.dev/commands/matt-dionis/claude-code-configs/add-tool"><img src="https://agentmods.dev/badge/commands/matt-dionis/claude-code-configs/add-tool/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/matt-dionis/claude-code-configs/add-tool"><img src="https://agentmods.dev/badge/commands/matt-dionis/claude-code-configs/add-tool.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.00000 | $0.01379 |
| Opus 5.5 | $0.00000 | $0.00552 |
| Sonnet 5.5 | $0.00000 | $0.00276 |
| Haiku 4.5 | $0.00000 | $0.00138 |
Grade A, and why
add-tool 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 3mo 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 — 207 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Add Tool to MCP Server
Adds a new tool to your MCP server with proper schema validation and error handling.
Usage
/add-tool <name> <description> [parameters]
Examples
/add-tool calculate "Performs mathematical calculations"
/add-tool search "Search for information" query:string limit:number?
/add-tool process_data "Process data with options" input:string format:enum[json,csv,xml]
Implementation
import { z } from 'zod';
import * as fs from 'fs/promises';
import * as path from 'path';
async function addTool(name: string, description: string, parameters?: string[]) {
// Parse parameters into schema
const schema = parseParameterSchema(parameters || []);
// Generate tool file
const toolContent = generateToolFile(name, description, schema);
// Write tool file
const toolPath = path.join('src/tools', `${name}.ts`);
await fs.writeFile(toolPath, toolContent);
// Update tool index
await updateToolIndex(name);
// Generate test file
const testContent = generateToolTest(name);
const testPath = path.join('tests/unit/tools', `${name}.test.ts`);
await fs.writeFile(testPath, testContent);
console.log(`✅ Tool "${name}" added successfully!`);
console.log(` - Implementation: ${toolPath}`);
console.log(` - Test file: ${testPath}`);
console.log(`\nNext steps:`);
console.log(` 1. Implement the tool logic in ${toolPath}`);
console.log(` 2. Run tests with "npm test"`);
console.log(` 3. Test with MCP Inspector`);
}
function parseParameterSchema(parameters: string[]): any {
const properties: Record<string, any> = {};
const required: string[] = [];
for (const param of parameters) {
const [nameType, ...rest] = param.split(':');
const isOptional = nameType.endsWith('?');
const name = isOptional ? nameType.slice(0, -1) : nameType;
const type = rest.join(':') || 'string';
if (!isOptional) {
required.push(name);
}
properties[name] = parseType(type);
}
return {
type: 'object',
properties,
required: required.length > 0 ? required : undefined,
};
}
function parseType(type: string): any {
if (type.startsWith('enum[')) {
const values = type.slice(5, -1).split(',');
return {
type: 'string',
enum: values,
};
}
switch (type) {
case 'number':
return { type: 'number' };
case 'boolean':
return { type: 'boolean' };
case 'array':
return { type: 'array', items: { type: 'string' } };
default:
return { type: 'string' };
}
}
function generateToolFile(name: string, description: string, schema: any): string {
return `
import { z } from 'zod';
import type { ToolHandler } from '../types/tools.js';
// Define Zod schema for validation
const ${capitalize(name)}Schema = z.object({
${generateZodSchema(schema.properties, ' ')}
});
export type ${capitalize(name)}Args = z.infer<typeof ${capitalize(name)}Schema>;
export const ${name}Tool = {
name: '${name}',
description: '${description}',
inputSchema: ${JSON.stringify(schema, null, 2)},
handler: async (args: unknown): Promise<ToolHandler> => {
// Validate input
const validated = ${capitalize(name)}Schema.parse(args);
// TODO: Implement your tool logic here
const result = await process${capitalize(name)}(validated);
return {
content: [
{
type: 'text',
text: JSON.stringify(result),
},
],
};
},
};
async function process${capitalize(name)}(args: ${capitalize(name)}Args) {
// TODO: Implement the actual processing logic
return {
success: true,
message: 'Tool executed successfully',
input: args,
};
}
`;
}
function generateZodSchema(properties: Record<string, any>, indent: string): string {
const lines: string[] = [];
for (const [key, value] of Object.entries(properties)) {
let zodType = 'z.string()';
if (value.type === 'number') {
zodType = 'z.number()';
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.
- 3mo ago First seen · 207 lines · 0 tokens per session scan A 6473a9fba57b
add-tool is a command published in the GitHub repository Matt-Dionis/claude-code-configs (619 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,379 tokens. 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.
add-tool compared with commands from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| add-toolMatt-Dionis/claude-code-configs | Command | 619 | 1y ago | MIT | A | 0 | Claude Code |
| checklistgithub/spec-kit | Command | 154k | today | MIT | A | 13 | Claude Code |
| clarifygithub/spec-kit | Command | 154k | today | MIT | A | 27 | Claude Code |
| specifygithub/spec-kit | Command | 154k | today | MIT | A | 13 | Claude Code |
| analyzegithub/spec-kit | Command | 154k | today | MIT | A | 26 | Claude Code |
| convergegithub/spec-kit | Command | 154k | today | MIT | A | 35 | Claude Code |
| implementgithub/spec-kit | Command | 154k | today | MIT | A | 14 | Claude Code |