Skip to content

Commit c17dd9a

Browse files
committed
*
1 parent 76a15b1 commit c17dd9a

File tree

1 file changed

+88
-6
lines changed

1 file changed

+88
-6
lines changed

modus/functions.mdx

Lines changed: 88 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ handle specific missions with precision and speed. Like elite reconnaissance
1111
units, they get in, complete their objective, and report back. No unnecessary
1212
complications, no lingering presence, just pure operational efficiency.
1313

14+
You can think of a function as an endpoint—each function you write automatically
15+
becomes a callable API endpoint that external systems can access.
16+
1417
Functions are the backbone of your intelligence network, handling everything
1518
from data gathering to AI-powered analysis, all while maintaining perfect
1619
operational discipline.
@@ -44,38 +47,118 @@ Most functions become GraphQL queries—perfect for reconnaissance and data
4447
retrieval:
4548

4649
```go
47-
// Becomes a GraphQL query: gatherThreatIntelligence(source: String!): ThreatReport
50+
// This function becomes a GraphQL query
4851
func GatherThreatIntelligence(source string) (*ThreatReport, error) {
4952
// Intelligence gathering operation
5053
return fetchThreatData(source)
5154
}
5255

53-
// Becomes a GraphQL query: analyzeSecurityPatterns(): SecurityAssessment
56+
// This function becomes a GraphQL query
5457
func AnalyzeSecurityPatterns() (*SecurityAssessment, error) {
5558
// Analysis operation using AI models
5659
return generateSecurityAnalysis()
5760
}
5861
```
5962

63+
Your operatives are now accessible via GraphQL:
64+
65+
```graphql
66+
query {
67+
gatherThreatIntelligence(source: "network_logs") {
68+
threatLevel
69+
indicators
70+
recommendations
71+
}
72+
73+
analyzeSecurityPatterns {
74+
riskScore
75+
anomalies
76+
actionItems
77+
}
78+
}
79+
```
80+
81+
**Response:**
82+
83+
```json
84+
{
85+
"data": {
86+
"gatherThreatIntelligence": {
87+
"threatLevel": "HIGH",
88+
"indicators": ["unusual_traffic", "failed_auth_attempts"],
89+
"recommendations": ["immediate_investigation", "block_suspicious_ips"]
90+
},
91+
"analyzeSecurityPatterns": {
92+
"riskScore": 8.5,
93+
"anomalies": ["off_hours_access", "geographic_anomaly"],
94+
"actionItems": ["verify_user_identity", "enable_2fa"]
95+
}
96+
}
97+
}
98+
```
99+
60100
### Operational change mutations
61101

62102
Functions that modify data automatically become GraphQL mutations. Modus detects
63103
these by their mission prefixes:
64104

65105
```go
66-
// Becomes a GraphQL mutation: createSecurityAlert(data: AlertInput!): SecurityAlert
106+
// This becomes a GraphQL mutation
67107
func CreateSecurityAlert(data AlertInput) (*SecurityAlert, error) {
68108
// Create new security alert
69109
return deploySecurityAlert(data)
70110
}
71111

72-
// Becomes a GraphQL mutation: updateThreatLevel(id: String!, level: String!): ThreatAssessment
112+
// This becomes a GraphQL mutation
73113
func UpdateThreatLevel(id string, level string) (*ThreatAssessment, error) {
74114
// Update threat assessment
75115
return modifyThreatRecord(id, level)
76116
}
77117
```
78118

119+
Now you can execute operational changes:
120+
121+
```graphql
122+
mutation {
123+
createSecurityAlert(
124+
data: {
125+
type: "INTRUSION_ATTEMPT"
126+
severity: "CRITICAL"
127+
source: "firewall_logs"
128+
}
129+
) {
130+
alertId
131+
status
132+
timestamp
133+
}
134+
135+
updateThreatLevel(id: "threat_001", level: "CRITICAL") {
136+
id
137+
newLevel
138+
escalated
139+
}
140+
}
141+
```
142+
143+
**Response:**
144+
145+
```json
146+
{
147+
"data": {
148+
"createSecurityAlert": {
149+
"alertId": "alert_20250115_001",
150+
"status": "ACTIVE",
151+
"timestamp": "2025-01-15T14:30:00Z"
152+
},
153+
"updateThreatLevel": {
154+
"id": "threat_001",
155+
"newLevel": "CRITICAL",
156+
"escalated": true
157+
}
158+
}
159+
}
160+
```
161+
79162
Functions starting with `create`, `update`, `delete`, and similar action words
80163
automatically become mutations.
81164

@@ -222,8 +305,7 @@ You'll receive a tactical intelligence report like:
222305
"conditions": "light rain",
223306
"analysis": "
224307
Light rain conditions will reduce visibility for surveillance operations and may impact equipment performance.
225-
Recommend waterproof gear and consider delayed outdoor activities requiring clear sight lines.
226-
"
308+
Recommend waterproof gear and consider delayed outdoor activities requiring clear sight lines."
227309
}
228310
}
229311
}

0 commit comments

Comments
 (0)