MCPcopy Create free account
hub / github.com/cronitorio/cronitor-cli / RegisterTools

Method RegisterTools

lib/mcp_handler.go:161–256  ·  view source on GitHub ↗

RegisterTools registers all MCP tools with the server

(s *server.MCPServer)

Source from the content-addressed store, hash-verified

159
160// RegisterTools registers all MCP tools with the server
161func (h *CronitorMCPHandler) RegisterTools(s *server.MCPServer) error {
162 // Create Cronjob Tool
163 tool := mcp.NewTool(
164 "create_cronjob",
165 mcp.WithDescription("Create a new cron job"),
166 mcp.WithString("name",
167 mcp.Required(),
168 mcp.Description("Name of the cron job"),
169 ),
170 mcp.WithString("command",
171 mcp.Required(),
172 mcp.Description("Command to execute"),
173 ),
174 mcp.WithString("schedule",
175 mcp.Required(),
176 mcp.Description("Cron expression or human-readable schedule (e.g., 'every 15 minutes')"),
177 ),
178 mcp.WithString("crontab_file",
179 mcp.Description("Target crontab file"),
180 ),
181 mcp.WithBoolean("monitored",
182 mcp.Description("Enable Cronitor monitoring"),
183 ),
184 mcp.WithString("run_as_user",
185 mcp.Description("User to run the job as"),
186 ),
187 )
188 s.AddTool(tool, h.handleCreateCronjob)
189
190 // List Cronjobs Tool
191 tool = mcp.NewTool(
192 "list_cronjobs",
193 mcp.WithDescription("List all cron jobs"),
194 mcp.WithString("filter",
195 mcp.Description("Filter by name or command"),
196 ),
197 )
198 s.AddTool(tool, h.handleListCronjobs)
199
200 // Update Cronjob Tool
201 tool = mcp.NewTool(
202 "update_cronjob",
203 mcp.WithDescription("Update an existing cron job"),
204 mcp.WithString("key",
205 mcp.Required(),
206 mcp.Description("Job key or identifier"),
207 ),
208 mcp.WithString("name",
209 mcp.Description("New name"),
210 ),
211 mcp.WithString("command",
212 mcp.Description("New command"),
213 ),
214 mcp.WithString("schedule",
215 mcp.Description("New schedule"),
216 ),
217 mcp.WithBoolean("suspended",
218 mcp.Description("Suspend/resume the job"),

Callers 1

runMCPServerFunction · 0.95

Calls 1

DescriptionMethod · 0.80

Tested by

no test coverage detected