一键导入
add-mcp-tool
How to expose a CSFD scraper function as a tool for AI agents via the Model Context Protocol server.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
How to expose a CSFD scraper function as a tool for AI agents via the Model Context Protocol server.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
A workflow to verify that code changes (refactoring, new features) didn't break the scraper or the build.
A complete guide to adding a new data field to the CSFD scraper (e.g., extracting "budget" or "studio" from a movie page).
| name | Add MCP Tool |
| description | How to expose a CSFD scraper function as a tool for AI agents via the Model Context Protocol server. |
This skill explains how to Register a new tool in the MCP server so it can be used by LLMs.
The functionality must already exist in a Service (e.g., csfd.movie(id)). If not, use the implement_scraper_feature skill first.
mcp-server/index.tsUse Zod to define the input arguments.
Rule: Every .describe() call is part of the prompt for the AI. Be descriptive!
const toolArgs = {
myParam: z.string().describe('Description of what this parameter does...')
};
Add the server.tool() call.
server.tool(
'tool_name_snake_case',
'A clear, action-oriented description of what the tool does. Mention required inputs.',
toolArgs,
async ({ myParam }) => {
try {
// 1. Call the service
const result = await csfd.someMethod(myParam);
// 2. Return JSON content
return {
content: [
{
type: 'text',
text: JSON.stringify(result, null, 2)
}
]
};
} catch (error) {
// 3. Handle errors gracefully
return {
content: [{ type: 'text', text: `Error: ${error}` }],
isError: true
};
}
}
);
yarn build:mcp (to check types)main() or use the MCP Inspector if configured.