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

Method handleCrontabsResource

lib/mcp_handler.go:559–584  ·  view source on GitHub ↗

Resource Handlers

(ctx context.Context, req mcp.ReadResourceRequest)

Source from the content-addressed store, hash-verified

557// Resource Handlers
558
559func (h *CronitorMCPHandler) handleCrontabsResource(ctx context.Context, req mcp.ReadResourceRequest) ([]mcp.ResourceContents, error) {
560 resp, err := h.makeAuthenticatedRequest("GET", h.apiURL+"/api/crontabs", nil)
561 if err != nil {
562 return nil, err
563 }
564
565 // Pretty print the JSON
566 var prettyJSON bytes.Buffer
567 if err := json.Indent(&prettyJSON, resp, "", " "); err != nil {
568 return []mcp.ResourceContents{
569 mcp.TextResourceContents{
570 URI: req.Params.URI,
571 MIMEType: "application/json",
572 Text: string(resp),
573 },
574 }, nil
575 }
576
577 return []mcp.ResourceContents{
578 mcp.TextResourceContents{
579 URI: req.Params.URI,
580 MIMEType: "application/json",
581 Text: prettyJSON.String(),
582 },
583 }, nil
584}
585
586func (h *CronitorMCPHandler) handleJobsResource(ctx context.Context, req mcp.ReadResourceRequest) ([]mcp.ResourceContents, error) {
587 resp, err := h.makeAuthenticatedRequest("GET", h.apiURL+"/api/jobs", nil)

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected