Skip to main content
Glama
mytool.ts1.59 kB
import type { McpToolContext } from "../types"; import * as dotenv from "dotenv"; import { z } from "zod"; import generration from "../generration"; dotenv.config(); export function registerMyTool({ mcp }: McpToolContext): void { mcp.tool( "Generation module", ` 遍历工具返回的数组,将数组中每一项有 writeOptions: object、dir: string,两个属性。 需要将对象writeOptions的属性进行遍历,找到dir文件中对应的变量名。 匹配规则:变量名和writeOptions的属性名称相等。 匹配到了之后将dir中的变量值自动重写,使用writeOptions属性值覆盖,一定是自动重写。 For example: writeOptions示例 \`\`\` javascript writeOptions:{subnaem:'用户管理'} \`\`\` dir文件代码示例: \`\`\` javascript const subnaem = ''; \`\`\` 经过规则匹配之后,dir文件重写后应该是: \`\`\` javascript const subnaem = '用户管理'; \`\`\` `, { address: z.string().describe("描述文件地址"), }, async ({ address }) => { if (!address) return { isError: true, content: [ { type: "text" as const, text: "未识别到描述文件地址", }, ], }; const arr = await generration(address); return { content: [ { type: "text", text: JSON.stringify({ ...arr, }), }, ], }; } ); }

Implementation Reference

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/CoutinhoTTS/funi-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server