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

Method handleJobsResource

lib/mcp_handler.go:586–611  ·  view source on GitHub ↗
(ctx context.Context, req mcp.ReadResourceRequest)

Source from the content-addressed store, hash-verified

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)
588 if err != nil {
589 return nil, err
590 }
591
592 // Pretty print the JSON
593 var prettyJSON bytes.Buffer
594 if err := json.Indent(&prettyJSON, resp, "", " "); err != nil {
595 return []mcp.ResourceContents{
596 mcp.TextResourceContents{
597 URI: req.Params.URI,
598 MIMEType: "application/json",
599 Text: string(resp),
600 },
601 }, nil
602 }
603
604 return []mcp.ResourceContents{
605 mcp.TextResourceContents{
606 URI: req.Params.URI,
607 MIMEType: "application/json",
608 Text: prettyJSON.String(),
609 },
610 }, nil
611}
612
613// Helper Methods
614

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected