بنقرة واحدة
code-writing
Write or modify tool handlers, utilities, and core logic in the docsgrep codebase
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Write or modify tool handlers, utilities, and core logic in the docsgrep codebase
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | code-writing |
| description | Write or modify tool handlers, utilities, and core logic in the docsgrep codebase |
AGENTS.md for repo conventions.Every tool must return McpToolResponse:
import type { McpToolResponse } from "../types/tools.js";
export async function handleMyTool(args: MyToolArgs): Promise<McpToolResponse> {
try {
const dirPath = validateDirPath(validateStringParam(args.dirPath, "dirPath"));
// ... do work ...
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) })];
} catch (error: any) {
return { content: [{ type: "text", text: error.message }], isError: true };
}
}
Extend BaseTool<T> from tools/base.ts when you need built-in concurrency control, logging, and credential masking. Then wrap in a thin function for the registry:
class MyTool extends BaseTool<MyToolArgs> {
protected async run(args: MyToolArgs): Promise<McpToolResponse> {
// ... implementation ...
}
}
export async function handleMyTool(args: MyToolArgs): Promise<McpToolResponse> {
return new MyTool().execute(args);
}
Add the handler to ToolRegistry in tools/registry.ts. For class-based tools, pass as an override in index.ts.
Add a JSON Schema entry to src/config/tools.json with name, description, and inputSchema.
.js extensions: every local import MUST end in .js.any: use typed args from types/tools.ts.validateDirPath and validateStringParam at entry.FileScanner.findFiles() from tools/base.ts — it handles .gitignore, includePath, excludePath.AppInfo from utils/app-info.ts, never hardcode version/name.operationLimiter from utils/semaphore.js.maskSensitive in tools/base.ts.