Documentation
¶
Index ¶
- Constants
- Variables
- func AckIncident(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func CloseIncident(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func CreateChangeTimeline(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func CreateIncident(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func CreateStatusIncident(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func DefaultToolsetGroup(getClient GetFlashdutyClientFn, readOnly bool, ...) *toolsets.ToolsetGroup
- func GetPresetTemplate(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func ListSimilarIncidents(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func ListStatusChanges(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func ListTemplateFunctions(_ GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func ListTemplateVariables(_ GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func MarshalResult(v any) *mcp.CallToolResult
- func OptionalInt(r mcp.CallToolRequest, p string) (int, error)
- func OptionalParam[T any](r mcp.CallToolRequest, p string) (T, error)
- func QueryAlertEvents(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func QueryChanges(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func QueryChannels(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func QueryEscalationRules(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func QueryFields(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func QueryIncidentAlerts(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func QueryIncidentTimeline(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func QueryIncidents(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func QueryMembers(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func QueryStatusPages(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func QueryTeams(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func RequiredInt(r mcp.CallToolRequest, p string) (int, error)
- func RequiredParam[T comparable](r mcp.CallToolRequest, p string) (T, error)
- func SetOutputFormat(format OutputFormat)
- func ToBoolPtr(b bool) *bool
- func UpdateIncident(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func ValidateTemplate(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
- func WithSince(opts ...mcp.PropertyOption) mcp.ToolOption
- func WithUntil(opts ...mcp.PropertyOption) mcp.ToolOption
- type Clients
- type GetFlashdutyClientFn
- type OutputFormat
Constants ¶
const ( SinceDescription = "Lower bound of the query window. " + "PREFER relative durations like \"24h\", \"7d\", \"30m\" — they are anchored " + "to server time and immune to your training-data cutoff. " + "Use absolute dates (\"2026-04-01\" or \"2026-04-01 10:00:00\") ONLY when " + "the user explicitly asked for a specific calendar date; double-check the " + "year, since picking the wrong year returns silently incorrect data. " + "Also accepts unix seconds (\"1712000000\") and \"now\". " + "Max window (until - since): 31 days. Data older than ~90 days may have been purged." UntilDescription = "Upper bound of the query window. Same formats as `since`, plus " + "future durations like \"+24h\", \"+7d\". Defaults to \"now\" when omitted. " + "Must be greater than `since` and within 31 days of it." )
SinceDescription / UntilDescription are reused across query_incidents and query_changes. The wording is tuned for LLM callers that otherwise pick absolute dates from stale training data and silently query the wrong year — see the three failure modes documented at https://github.com/flashcatcloud/flashduty-mcp-server/pull/50.
const DefaultIncidentWindow = 30 * 24 * time.Hour
DefaultIncidentWindow is the lookback query_incidents applies when the caller omits both since and until ("current open incidents" with no explicit range). Kept under MaxTimeWindow so the defaulted span never trips the backend cap.
const LimitDescription = "Maximum number of results per page. Default 20, max 100. " +
"When more results exist than were returned, the response carries " +
"`truncated:true` and a `hint` field with concrete next steps."
LimitDescription is the canonical description for the `limit` parameter on list-shaped tools. Mentioning `truncated`/`total` up front primes the LLM to inspect them before assuming it has the full result.
const MaxTimeWindow = 31 * 24 * time.Hour
MaxTimeWindow is the backend's hard cap on (until-since) for incident/alert/change queries. Exceeding it produces a 400 from the API; we mirror the cap client-side so the LLM gets a guided error before the round-trip.
const PageDescription = "1-based page number for paging through results beyond `limit`. " +
"Default 1. When the response is `truncated`, request `page:2` (then 3, …) to fetch the rest."
PageDescription is the canonical description for the `page` parameter on list-shaped tools. Pairs with `limit`: page N returns results [(N-1)*limit, N*limit). Advertised alongside the `truncated`/`hint` fields so the LLM knows how to reach results beyond the first page.
Variables ¶
var DefaultTools = []string{"incidents", "alerts", "changes", "status_page", "users", "channels", "fields", "templates"}
DefaultTools is the default list of enabled Flashduty toolsets
Functions ¶
func AckIncident ¶
func AckIncident(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
AckIncident creates a tool to acknowledge incidents
func CloseIncident ¶ added in v0.4.0
func CloseIncident(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
CloseIncident creates a tool to close incidents
func CreateChangeTimeline ¶ added in v0.4.0
func CreateChangeTimeline(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
CreateChangeTimeline creates a tool to add timeline entry to status change
func CreateIncident ¶
func CreateIncident(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
CreateIncident creates a tool to create a new incident
func CreateStatusIncident ¶ added in v0.4.0
func CreateStatusIncident(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
CreateStatusIncident creates a tool to create status page incident
func DefaultToolsetGroup ¶
func DefaultToolsetGroup(getClient GetFlashdutyClientFn, readOnly bool, t translations.TranslationHelperFunc) *toolsets.ToolsetGroup
DefaultToolsetGroup returns the default toolset group for Flashduty
func GetPresetTemplate ¶ added in v0.9.6
func GetPresetTemplate(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
GetPresetTemplate creates a tool to fetch the preset template for a channel.
func ListSimilarIncidents ¶ added in v0.4.0
func ListSimilarIncidents(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
ListSimilarIncidents creates a tool to find similar incidents
func ListStatusChanges ¶ added in v0.4.0
func ListStatusChanges(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
ListStatusChanges creates a tool to list status page changes
func ListTemplateFunctions ¶ added in v0.9.6
func ListTemplateFunctions(_ GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
ListTemplateFunctions creates a tool that returns the available template functions.
func ListTemplateVariables ¶ added in v0.9.6
func ListTemplateVariables(_ GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
ListTemplateVariables creates a tool that returns the available template variable schema.
func MarshalResult ¶ added in v0.4.0
func MarshalResult(v any) *mcp.CallToolResult
MarshalResult serializes the given value according to the current output format and returns it as a text result for an MCP tool response.
Values come from go-flashduty, whose Timestamp/TimestampMilli types already render absolute instants as RFC3339, so no post-processing is needed.
func OptionalInt ¶
func OptionalInt(r mcp.CallToolRequest, p string) (int, error)
OptionalInt is a helper function that can be used to fetch a requested parameter from the request. It does the following checks: 1. Checks if the parameter is present in the request, if not, it returns its zero-value 2. If it is present, it checks if the parameter is of the expected type and returns it
func OptionalParam ¶
func OptionalParam[T any](r mcp.CallToolRequest, p string) (T, error)
OptionalParam is a helper function that can be used to fetch a requested parameter from the request. It does the following checks: 1. Checks if the parameter is present in the request, if not, it returns its zero-value 2. If it is present, it checks if the parameter is of the expected type and returns it
func QueryAlertEvents ¶ added in v0.9.6
func QueryAlertEvents(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
QueryAlertEvents creates a tool to query raw events of a single alert.
func QueryChanges ¶ added in v0.4.0
func QueryChanges(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
QueryChanges creates a tool to query change records
func QueryChannels ¶ added in v0.4.0
func QueryChannels(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
QueryChannels creates a tool to query channels
func QueryEscalationRules ¶ added in v0.4.0
func QueryEscalationRules(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
QueryEscalationRules creates a tool to query escalation rules
func QueryFields ¶ added in v0.4.0
func QueryFields(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
QueryFields creates a tool to query custom field definitions
func QueryIncidentAlerts ¶ added in v0.4.0
func QueryIncidentAlerts(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
QueryIncidentAlerts creates a tool to query incident alerts
func QueryIncidentTimeline ¶ added in v0.4.0
func QueryIncidentTimeline(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
QueryIncidentTimeline creates a tool to query incident timeline
func QueryIncidents ¶ added in v0.4.0
func QueryIncidents(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
QueryIncidents creates a tool to query incidents with enriched data
func QueryMembers ¶ added in v0.4.0
func QueryMembers(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
QueryMembers creates a tool to query members
func QueryStatusPages ¶ added in v0.4.0
func QueryStatusPages(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
QueryStatusPages creates a tool to query status pages
func QueryTeams ¶ added in v0.4.0
func QueryTeams(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
QueryTeams creates a tool to query teams
func RequiredInt ¶
func RequiredInt(r mcp.CallToolRequest, p string) (int, error)
RequiredInt is a helper function that can be used to fetch a requested parameter from the request. It does the following checks: 1. Checks if the parameter is present in the request. 2. Checks if the parameter is of the expected type. 3. Checks if the parameter is not empty, i.e: non-zero value
func RequiredParam ¶
func RequiredParam[T comparable](r mcp.CallToolRequest, p string) (T, error)
RequiredParam is a helper function that can be used to fetch a requested parameter from the request. It does the following checks: 1. Checks if the parameter is present in the request. 2. Checks if the parameter is of the expected type. 3. Checks if the parameter is not empty, i.e: non-zero value
func SetOutputFormat ¶ added in v0.4.0
func SetOutputFormat(format OutputFormat)
SetOutputFormat sets the global output format
func UpdateIncident ¶ added in v0.4.0
func UpdateIncident(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
UpdateIncident creates a tool to update an incident
func ValidateTemplate ¶ added in v0.9.6
func ValidateTemplate(getClient GetFlashdutyClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc)
ValidateTemplate creates a tool to validate and preview a template.
func WithSince ¶ added in v0.9.6
func WithSince(opts ...mcp.PropertyOption) mcp.ToolOption
WithSince / WithUntil are convenience wrappers that apply the canonical descriptions.
func WithUntil ¶ added in v0.9.6
func WithUntil(opts ...mcp.PropertyOption) mcp.ToolOption
Types ¶
type Clients ¶ added in v0.9.11
Clients bundles the Flashduty API clients a tool handler may need.
New is the typed go-flashduty client and backs every tool.
type GetFlashdutyClientFn ¶
GetFlashdutyClientFn returns the Flashduty clients for the current request.
type OutputFormat ¶ added in v0.4.0
type OutputFormat string
OutputFormat defines the serialization format for tool results.
const ( // OutputFormatJSON uses standard JSON serialization (default) OutputFormatJSON OutputFormat = "json" // OutputFormatTOON uses Token-Oriented Object Notation for reduced token usage OutputFormatTOON OutputFormat = "toon" )
func GetOutputFormat ¶ added in v0.4.0
func GetOutputFormat() OutputFormat
GetOutputFormat returns the current global output format
func ParseOutputFormat ¶ added in v0.4.0
func ParseOutputFormat(s string) OutputFormat
ParseOutputFormat converts a string to OutputFormat, defaulting to JSON.
func (OutputFormat) String ¶ added in v0.4.0
func (f OutputFormat) String() string
String returns the string representation of OutputFormat.