latitude-mcp-server 3.0.1 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +421 -139
- package/dist/api.d.ts +1 -8
- package/dist/api.js +0 -38
- package/dist/index.js +1 -1
- package/dist/server.js +1 -1
- package/dist/tools.d.ts +8 -9
- package/dist/tools.js +117 -149
- package/package.json +1 -1
- package/prompts/cover-letter-generate.promptl +71 -0
- package/prompts/cv-ingest-questions.promptl +386 -0
- package/prompts/cv-ingest.promptl +449 -0
- package/prompts/job-filter-bootstrap.promptl +115 -0
- package/prompts/job-filter-refine.promptl +173 -0
- package/prompts/linkedin-search.promptl +225 -0
- package/prompts/pattern-bootstrap.promptl +2753 -0
- package/prompts/pattern-refine.promptl +247 -0
- package/prompts/question-generate.promptl +172 -0
- package/prompts/research-discover.promptl +235 -0
- package/prompts/research-validate.promptl +193 -0
package/README.md
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
# Latitude MCP Server
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> **AI-powered prompt management** for [Latitude.so](https://latitude.so) via Model Context Protocol
|
|
4
4
|
|
|
5
|
-
Manage
|
|
5
|
+
Manage PromptL prompts directly from Claude, Windsurf, or any MCP client. Features **intelligent validation**, **dynamic tool descriptions**, and **git-style versioning**.
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/latitude-mcp-server)
|
|
8
8
|
[](https://opensource.org/licenses/ISC)
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
## Features
|
|
12
|
+
## ✨ Key Features
|
|
13
13
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
14
|
+
- **🤖 Smart Validation** - Client-side PromptL validation with AST-powered error messages
|
|
15
|
+
- **📋 Dynamic Descriptions** - Tools show available prompts and their parameters automatically
|
|
16
|
+
- **🔄 Full Sync** - Push/pull with automatic conflict resolution
|
|
17
|
+
- **🎯 Atomic Operations** - Validate ALL before pushing ANY (all-or-nothing)
|
|
18
|
+
- **📚 52 Doc Topics** - Comprehensive PromptL syntax guide with semantic search
|
|
19
|
+
- **🏷️ Git-Style Versioning** - Name your changes like commits (feat/add-auth, fix/typo)
|
|
20
|
+
- **⚡ Zero Config** - Just set `LATITUDE_API_KEY` and go
|
|
20
21
|
|
|
21
22
|
---
|
|
22
23
|
|
|
@@ -60,86 +61,209 @@ Add to your MCP client config (e.g., Claude Desktop):
|
|
|
60
61
|
|
|
61
62
|
---
|
|
62
63
|
|
|
63
|
-
## Available Tools
|
|
64
|
+
## 🛠️ Available Tools (7)
|
|
64
65
|
|
|
65
|
-
| Tool | Description |
|
|
66
|
-
|
|
67
|
-
| `list_prompts` | List all prompts in LIVE
|
|
68
|
-
| `get_prompt` | Get full prompt content by name |
|
|
69
|
-
| `run_prompt` | Execute
|
|
70
|
-
| `push_prompts` | Replace ALL prompts (
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
|
|
66
|
+
| Tool | Type | Description |
|
|
67
|
+
|------|------|-------------|
|
|
68
|
+
| `list_prompts` | Read | List all prompts in LIVE |
|
|
69
|
+
| `get_prompt` | Read | Get full prompt content by name |
|
|
70
|
+
| `run_prompt` | Execute | 🎯 **Dynamic:** Shows all prompts with their parameters |
|
|
71
|
+
| `push_prompts` | Write | 🔄 **FULL SYNC:** Replace ALL prompts (deletes extras) |
|
|
72
|
+
| `pull_prompts` | Read | 🔄 **FULL SYNC:** Download all prompts (deletes local first) |
|
|
73
|
+
| `add_prompt` | Write | 🎯 **Dynamic:** Add/update prompts (shows available prompts) |
|
|
74
|
+
| `docs` | Read | Get documentation (52 topics, semantic search) |
|
|
75
|
+
|
|
76
|
+
### 🎯 What Makes This Special?
|
|
77
|
+
|
|
78
|
+
**Dynamic Tool Descriptions** - The MCP server updates tool descriptions in real-time:
|
|
79
|
+
- `run_prompt` shows: `"my-prompt" (params: name, email, company)`
|
|
80
|
+
- `add_prompt` shows: `"Available prompts (10): prompt-a, prompt-b, ..."`
|
|
81
|
+
|
|
82
|
+
Your AI assistant sees exactly what prompts exist and what parameters they need!
|
|
75
83
|
|
|
76
84
|
---
|
|
77
85
|
|
|
78
|
-
##
|
|
86
|
+
## 🚀 Real-World Workflows
|
|
79
87
|
|
|
80
|
-
###
|
|
88
|
+
### Workflow 1: New Project Setup
|
|
81
89
|
|
|
82
|
-
```
|
|
90
|
+
```bash
|
|
91
|
+
# Pull all prompts from LIVE to start local development
|
|
83
92
|
pull_prompts({ outputDir: "./prompts" })
|
|
93
|
+
# Downloads 10 files to ./prompts/
|
|
94
|
+
# Deletes any existing local .promptl files first (FULL SYNC)
|
|
84
95
|
```
|
|
85
96
|
|
|
86
|
-
|
|
97
|
+
**What you see:**
|
|
98
|
+
```
|
|
99
|
+
✅ Prompts Pulled from LIVE
|
|
87
100
|
|
|
88
|
-
|
|
101
|
+
Directory: /Users/you/project/prompts
|
|
102
|
+
Deleted: 0 existing files
|
|
103
|
+
Written: 10 files
|
|
89
104
|
|
|
90
|
-
|
|
91
|
-
|
|
105
|
+
Files:
|
|
106
|
+
- cover-letter-generate.promptl
|
|
107
|
+
- sentiment-analyzer.promptl
|
|
108
|
+
...
|
|
109
|
+
|
|
110
|
+
Tip: Edit files locally, then use `add_prompt` to push changes.
|
|
92
111
|
```
|
|
93
112
|
|
|
94
|
-
|
|
113
|
+
### Workflow 2: Add New Prompt (with Dynamic Guidance)
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# The tool description shows you what prompts already exist!
|
|
117
|
+
add_prompt({
|
|
118
|
+
prompts: [{
|
|
119
|
+
name: "email-writer",
|
|
120
|
+
content: `---
|
|
121
|
+
provider: openai
|
|
122
|
+
model: gpt-4o
|
|
123
|
+
---
|
|
124
|
+
<user>
|
|
125
|
+
Write email to {{ recipient }} about {{ topic }}
|
|
126
|
+
</user>`
|
|
127
|
+
}],
|
|
128
|
+
versionName: "feat/add-email-writer" # Optional git-style naming
|
|
129
|
+
})
|
|
130
|
+
```
|
|
95
131
|
|
|
96
|
-
|
|
132
|
+
**Dynamic Description Shows:**
|
|
133
|
+
```
|
|
134
|
+
Add or update prompt(s) in LIVE without deleting others.
|
|
97
135
|
|
|
136
|
+
Available prompts (10): cover-letter-generate, sentiment-analyzer, ...
|
|
98
137
|
```
|
|
99
|
-
|
|
138
|
+
|
|
139
|
+
**Result:**
|
|
100
140
|
```
|
|
141
|
+
✅ Prompts Added to LIVE
|
|
101
142
|
|
|
102
|
-
|
|
143
|
+
Summary:
|
|
144
|
+
- Added: 1
|
|
145
|
+
- Updated: 0
|
|
103
146
|
|
|
104
|
-
|
|
147
|
+
Added:
|
|
148
|
+
- email-writer
|
|
105
149
|
|
|
150
|
+
Current LIVE prompts (11): cover-letter-generate, ..., email-writer
|
|
106
151
|
```
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
152
|
+
|
|
153
|
+
### Workflow 3: Run Prompt (with Parameter Discovery)
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# The tool description shows you what parameters each prompt needs!
|
|
157
|
+
run_prompt({
|
|
158
|
+
name: "email-writer",
|
|
159
|
+
parameters: {
|
|
160
|
+
recipient: "Alice",
|
|
161
|
+
topic: "project update"
|
|
162
|
+
}
|
|
110
163
|
})
|
|
111
164
|
```
|
|
112
165
|
|
|
113
|
-
|
|
166
|
+
**Dynamic Description Shows:**
|
|
167
|
+
```
|
|
168
|
+
Execute a prompt with parameters.
|
|
114
169
|
|
|
115
|
-
|
|
170
|
+
Available prompts (11):
|
|
171
|
+
- cover-letter-generate (params: job_details, career_patterns, company_name)
|
|
172
|
+
- email-writer (params: recipient, topic)
|
|
173
|
+
- sentiment-analyzer (no params)
|
|
174
|
+
...
|
|
175
|
+
```
|
|
116
176
|
|
|
177
|
+
**Result:**
|
|
117
178
|
```
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
179
|
+
✅ Prompt Executed
|
|
180
|
+
|
|
181
|
+
Prompt: email-writer
|
|
182
|
+
|
|
183
|
+
Parameters:
|
|
184
|
+
{
|
|
185
|
+
"recipient": "Alice",
|
|
186
|
+
"topic": "project update"
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
Response:
|
|
190
|
+
Subject: Project Update
|
|
191
|
+
|
|
192
|
+
Dear Alice,
|
|
193
|
+
|
|
194
|
+
I wanted to share an update on our project...
|
|
195
|
+
|
|
196
|
+
Tokens: 245 total
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Workflow 4: Validation Catches Errors
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# Try to add a prompt with nested tags (invalid PromptL)
|
|
203
|
+
add_prompt({
|
|
204
|
+
prompts: [{
|
|
205
|
+
name: "broken",
|
|
206
|
+
content: `---
|
|
207
|
+
model: gpt-4
|
|
123
208
|
---
|
|
124
|
-
|
|
209
|
+
<user><assistant>Nested!</assistant></user>`
|
|
210
|
+
}]
|
|
125
211
|
})
|
|
126
212
|
```
|
|
127
213
|
|
|
128
|
-
|
|
214
|
+
**Validation Error (Before ANY API Call):**
|
|
215
|
+
```
|
|
216
|
+
❌ Validation Failed - No Changes Made
|
|
129
217
|
|
|
130
|
-
|
|
218
|
+
1 prompt(s) have errors. Fix all errors before pushing.
|
|
131
219
|
|
|
220
|
+
### broken
|
|
221
|
+
Error Code: `message-tag-inside-message`
|
|
222
|
+
Error: Message tags cannot be inside of another message
|
|
223
|
+
Root Cause: Message/role tags (<system>, <user>, <assistant>, <tool>) cannot be nested.
|
|
224
|
+
Location: Line 4, Column 7
|
|
225
|
+
Code Context:
|
|
132
226
|
```
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
227
|
+
2: model: gpt-4
|
|
228
|
+
3: ---
|
|
229
|
+
4: <user><assistant>Nested!</assistant></user>
|
|
230
|
+
|
|
231
|
+
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
136
232
|
```
|
|
233
|
+
Fix: Move the nested tag outside its parent. Use code block (```yaml) for examples.
|
|
137
234
|
|
|
138
|
-
|
|
235
|
+
Action Required: Fix the errors above, then retry.
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Workflow 5: Full Sync (Initialization)
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
# Push local prompts to LIVE - deletes remote prompts not in your list
|
|
242
|
+
push_prompts({
|
|
243
|
+
filePaths: [
|
|
244
|
+
"./prompts/prompt-a.promptl",
|
|
245
|
+
"./prompts/prompt-b.promptl",
|
|
246
|
+
"./prompts/prompt-c.promptl"
|
|
247
|
+
],
|
|
248
|
+
versionName: "feat/initial-prompts" # Optional
|
|
249
|
+
})
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**Result:**
|
|
253
|
+
```
|
|
254
|
+
✅ Prompts Pushed to LIVE
|
|
255
|
+
|
|
256
|
+
Summary:
|
|
257
|
+
- Added: 3
|
|
258
|
+
- Modified: 0
|
|
259
|
+
- Deleted: 8 # Removed old prompts not in your list
|
|
260
|
+
|
|
261
|
+
Current LIVE prompts (3): prompt-a, prompt-b, prompt-c
|
|
262
|
+
```
|
|
139
263
|
|
|
140
264
|
---
|
|
141
265
|
|
|
142
|
-
## Documentation Topics (52)
|
|
266
|
+
## 📚 Documentation Topics (52)
|
|
143
267
|
|
|
144
268
|
### Core Syntax (12)
|
|
145
269
|
`overview`, `structure`, `variables`, `conditionals`, `loops`, `references`, `tools`, `chains`, `agents`, `techniques`, `agent-patterns`, `mocking`
|
|
@@ -164,24 +288,48 @@ Access comprehensive PromptL documentation (52 topics).
|
|
|
164
288
|
|
|
165
289
|
---
|
|
166
290
|
|
|
167
|
-
## Development
|
|
291
|
+
## 🛠️ Development
|
|
168
292
|
|
|
169
293
|
### Build
|
|
170
294
|
|
|
171
295
|
```bash
|
|
172
|
-
npm run build
|
|
296
|
+
npm run build # Compiles TypeScript to dist/
|
|
173
297
|
```
|
|
174
298
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
### Test with MCP Inspector
|
|
299
|
+
### Testing with MCP Inspector
|
|
178
300
|
|
|
179
301
|
```bash
|
|
302
|
+
# List all tools
|
|
180
303
|
npx @modelcontextprotocol/inspector \
|
|
181
304
|
-e LATITUDE_API_KEY=your-key \
|
|
182
305
|
-e LATITUDE_PROJECT_ID=your-id \
|
|
183
306
|
--cli node dist/index.js \
|
|
184
307
|
--method tools/list
|
|
308
|
+
|
|
309
|
+
# Test list_prompts
|
|
310
|
+
npx @modelcontextprotocol/inspector \
|
|
311
|
+
-e LATITUDE_API_KEY=your-key \
|
|
312
|
+
-e LATITUDE_PROJECT_ID=your-id \
|
|
313
|
+
--cli node dist/index.js \
|
|
314
|
+
--method tools/call \
|
|
315
|
+
--tool-name list_prompts
|
|
316
|
+
|
|
317
|
+
# Test add_prompt with file
|
|
318
|
+
npx @modelcontextprotocol/inspector \
|
|
319
|
+
-e LATITUDE_API_KEY=your-key \
|
|
320
|
+
-e LATITUDE_PROJECT_ID=your-id \
|
|
321
|
+
--cli node dist/index.js \
|
|
322
|
+
--method tools/call \
|
|
323
|
+
--tool-name add_prompt \
|
|
324
|
+
--tool-arg 'filePaths=["./prompts/test.promptl"]'
|
|
325
|
+
|
|
326
|
+
# Test from npm package
|
|
327
|
+
npx @modelcontextprotocol/inspector \
|
|
328
|
+
-e LATITUDE_API_KEY=your-key \
|
|
329
|
+
-e LATITUDE_PROJECT_ID=your-id \
|
|
330
|
+
--cli npx -y latitude-mcp-server@3.1.0 \
|
|
331
|
+
--method tools/call \
|
|
332
|
+
--tool-name list_prompts
|
|
185
333
|
```
|
|
186
334
|
|
|
187
335
|
### Local Development
|
|
@@ -193,6 +341,10 @@ node dist/index.js
|
|
|
193
341
|
|
|
194
342
|
# With environment variables
|
|
195
343
|
LATITUDE_API_KEY=xxx LATITUDE_PROJECT_ID=yyy node dist/index.js
|
|
344
|
+
|
|
345
|
+
# Watch mode (requires nodemon)
|
|
346
|
+
npm install -g nodemon
|
|
347
|
+
nodemon --watch src --exec "npm run build && node dist/index.js"
|
|
196
348
|
```
|
|
197
349
|
|
|
198
350
|
---
|
|
@@ -281,63 +433,103 @@ Use `docs({ action: "get", topic: "overview" })` for complete guide.
|
|
|
281
433
|
|
|
282
434
|
---
|
|
283
435
|
|
|
284
|
-
##
|
|
436
|
+
## 📖 Tool Reference
|
|
285
437
|
|
|
286
438
|
### list_prompts()
|
|
287
439
|
|
|
288
440
|
List all prompts in LIVE version.
|
|
289
441
|
|
|
290
|
-
**Returns:** Array of prompt names
|
|
442
|
+
**Returns:** Array of prompt names with project ID
|
|
443
|
+
|
|
444
|
+
**Example:**
|
|
445
|
+
```javascript
|
|
446
|
+
list_prompts()
|
|
447
|
+
// Returns: cover-letter-generate, sentiment-analyzer, email-writer (10 total)
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
---
|
|
291
451
|
|
|
292
452
|
### get_prompt({ name })
|
|
293
453
|
|
|
294
|
-
Get full prompt content.
|
|
454
|
+
Get full prompt content by name.
|
|
295
455
|
|
|
296
456
|
**Parameters:**
|
|
297
457
|
- `name` (string) - Prompt name
|
|
298
458
|
|
|
299
|
-
**Returns:**
|
|
459
|
+
**Returns:** Full PromptL content with config and messages
|
|
460
|
+
|
|
461
|
+
**Example:**
|
|
462
|
+
```javascript
|
|
463
|
+
get_prompt({ name: "email-writer" })
|
|
464
|
+
// Returns full .promptl content
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
---
|
|
300
468
|
|
|
301
469
|
### run_prompt({ name, parameters })
|
|
302
470
|
|
|
303
|
-
Execute a prompt.
|
|
471
|
+
🎯 **Dynamic:** Execute a prompt. Tool description shows all prompts with their parameters!
|
|
304
472
|
|
|
305
473
|
**Parameters:**
|
|
306
474
|
- `name` (string) - Prompt name
|
|
307
|
-
- `parameters` (object) - Input parameters
|
|
475
|
+
- `parameters` (object, optional) - Input parameters
|
|
308
476
|
|
|
309
|
-
**Returns:** AI response
|
|
477
|
+
**Returns:** AI response with token usage
|
|
310
478
|
|
|
311
|
-
|
|
479
|
+
**Dynamic Description:**
|
|
480
|
+
```
|
|
481
|
+
Available prompts (10):
|
|
482
|
+
- email-writer (params: recipient, topic)
|
|
483
|
+
- sentiment-analyzer (no params)
|
|
484
|
+
- cover-letter-generate (params: job_details, career_patterns, company_name)
|
|
485
|
+
```
|
|
312
486
|
|
|
313
|
-
|
|
487
|
+
**Example:**
|
|
488
|
+
```javascript
|
|
489
|
+
run_prompt({
|
|
490
|
+
name: "email-writer",
|
|
491
|
+
parameters: { recipient: "Alice", topic: "update" }
|
|
492
|
+
})
|
|
493
|
+
```
|
|
314
494
|
|
|
315
|
-
|
|
316
|
-
- `outputDir` (string, optional) - Output directory (default: `./prompts`)
|
|
495
|
+
---
|
|
317
496
|
|
|
318
|
-
|
|
497
|
+
### add_prompt({ prompts?, filePaths?, versionName? })
|
|
319
498
|
|
|
320
|
-
|
|
499
|
+
🎯 **Dynamic:** Add or update prompts without deleting others. Tool description shows available prompts!
|
|
321
500
|
|
|
322
|
-
|
|
501
|
+
**Behavior:** If prompt exists → overwrites. If new → adds. Never deletes other prompts.
|
|
323
502
|
|
|
324
|
-
**Parameters (choose one
|
|
503
|
+
**Parameters (choose one):**
|
|
325
504
|
|
|
326
505
|
**Option A - Direct content:**
|
|
327
|
-
- `
|
|
328
|
-
|
|
506
|
+
- `prompts` (array) - Array of `{ name, content }`
|
|
507
|
+
|
|
508
|
+
**Option B - From files:**
|
|
509
|
+
- `filePaths` (array) - Array of paths to `.promptl` files
|
|
510
|
+
|
|
511
|
+
**Common:**
|
|
512
|
+
- `versionName` (string, optional) - Git-style name like `feat/add-auth` or `fix/typo`
|
|
513
|
+
|
|
514
|
+
**Returns:** Summary of added/updated prompts
|
|
329
515
|
|
|
330
|
-
**
|
|
331
|
-
|
|
332
|
-
|
|
516
|
+
**Example:**
|
|
517
|
+
```javascript
|
|
518
|
+
add_prompt({
|
|
519
|
+
filePaths: ["./prompts/new-prompt.promptl"],
|
|
520
|
+
versionName: "feat/add-new-prompt"
|
|
521
|
+
})
|
|
522
|
+
```
|
|
333
523
|
|
|
334
|
-
|
|
524
|
+
---
|
|
525
|
+
|
|
526
|
+
### push_prompts({ prompts?, filePaths?, versionName? })
|
|
335
527
|
|
|
336
|
-
|
|
528
|
+
🔄 **FULL SYNC:** Replace ALL prompts in LIVE. Deletes remote prompts not in your list.
|
|
337
529
|
|
|
338
|
-
|
|
530
|
+
**Use for:** Initial setup, complete sync, resetting LIVE to match local.
|
|
339
531
|
|
|
340
|
-
**Parameters (choose one
|
|
532
|
+
**Parameters (choose one):**
|
|
341
533
|
|
|
342
534
|
**Option A - Direct content:**
|
|
343
535
|
- `prompts` (array) - Array of `{ name, content }`
|
|
@@ -346,106 +538,196 @@ Add prompts without removing existing ones.
|
|
|
346
538
|
- `filePaths` (array) - Array of paths to `.promptl` files
|
|
347
539
|
|
|
348
540
|
**Common:**
|
|
349
|
-
- `
|
|
541
|
+
- `versionName` (string, optional) - Git-style name like `feat/initial-setup`
|
|
350
542
|
|
|
351
|
-
**Returns:**
|
|
543
|
+
**Returns:** Summary of added/modified/deleted prompts
|
|
352
544
|
|
|
353
|
-
|
|
545
|
+
**Example:**
|
|
546
|
+
```javascript
|
|
547
|
+
push_prompts({
|
|
548
|
+
filePaths: ["./prompts/prompt-a.promptl", "./prompts/prompt-b.promptl"],
|
|
549
|
+
versionName: "feat/complete-rewrite"
|
|
550
|
+
})
|
|
551
|
+
```
|
|
354
552
|
|
|
355
|
-
|
|
553
|
+
---
|
|
356
554
|
|
|
357
|
-
|
|
555
|
+
### pull_prompts({ outputDir? })
|
|
358
556
|
|
|
359
|
-
**
|
|
360
|
-
- `prompts` (array) - Array of `{ name, content }`
|
|
557
|
+
🔄 **FULL SYNC:** Download all prompts from LIVE. Deletes existing local `.promptl` files first.
|
|
361
558
|
|
|
362
|
-
**
|
|
363
|
-
- `filePaths` (array) - Array of paths to `.promptl` files
|
|
559
|
+
**Use for:** Initial clone, resetting local to match LIVE.
|
|
364
560
|
|
|
365
|
-
**
|
|
561
|
+
**Parameters:**
|
|
562
|
+
- `outputDir` (string, optional) - Output directory (default: `./prompts`)
|
|
563
|
+
|
|
564
|
+
**Returns:** List of downloaded files
|
|
565
|
+
|
|
566
|
+
**Example:**
|
|
567
|
+
```javascript
|
|
568
|
+
pull_prompts({ outputDir: "./my-prompts" })
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
---
|
|
366
572
|
|
|
367
573
|
### docs({ action, topic?, query? })
|
|
368
574
|
|
|
369
|
-
|
|
575
|
+
Access comprehensive PromptL documentation (52 topics).
|
|
370
576
|
|
|
371
577
|
**Parameters:**
|
|
372
|
-
- `action` (string) - `"help"
|
|
578
|
+
- `action` (string) - `"help"` (overview), `"get"` (topic), or `"find"` (search)
|
|
373
579
|
- `topic` (string, optional) - Topic name for `"get"`
|
|
374
580
|
- `query` (string, optional) - Search query for `"find"`
|
|
375
581
|
|
|
376
582
|
**Returns:** Documentation content
|
|
377
583
|
|
|
584
|
+
**Examples:**
|
|
585
|
+
```javascript
|
|
586
|
+
docs({ action: "help" }) // Overview
|
|
587
|
+
docs({ action: "find", query: "json output" }) // Semantic search
|
|
588
|
+
docs({ action: "get", topic: "chains" }) // Specific topic
|
|
589
|
+
```
|
|
590
|
+
|
|
378
591
|
---
|
|
379
592
|
|
|
380
|
-
##
|
|
593
|
+
## ✅ Validation Features
|
|
381
594
|
|
|
382
|
-
###
|
|
595
|
+
### Client-Side Validation with AST
|
|
383
596
|
|
|
384
|
-
|
|
385
|
-
// 1. Pull all prompts to local files
|
|
386
|
-
pull_prompts({ outputDir: "./prompts" })
|
|
387
|
-
// Creates: ./prompts/my-prompt.promptl, ./prompts/other-prompt.promptl, etc.
|
|
597
|
+
All write operations (`add_prompt`, `push_prompts`) validate prompts **before** making API calls using the official `promptl-ai` library.
|
|
388
598
|
|
|
389
|
-
|
|
599
|
+
**Benefits:**
|
|
600
|
+
- ⚡ **Fast feedback** - No wasted API calls
|
|
601
|
+
- 🎯 **Precise errors** - Exact line and column numbers
|
|
602
|
+
- 📝 **Code frames** - See surrounding context with `^~~~` pointer
|
|
603
|
+
- 🤖 **LLM-actionable** - Errors include root cause and fix suggestions
|
|
390
604
|
|
|
391
|
-
|
|
392
|
-
replace_prompt({ filePath: "./prompts/my-prompt.promptl" })
|
|
605
|
+
### Atomic Operations
|
|
393
606
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
607
|
+
**Validate ALL, push ALL or NOTHING:**
|
|
608
|
+
|
|
609
|
+
```javascript
|
|
610
|
+
// Trying to push 10 prompts, but 1 has an error
|
|
611
|
+
add_prompt({
|
|
612
|
+
filePaths: [
|
|
613
|
+
"./prompts/valid-1.promptl",
|
|
614
|
+
"./prompts/valid-2.promptl",
|
|
615
|
+
"./prompts/BROKEN.promptl", // Has nested tags
|
|
616
|
+
// ... 7 more valid prompts
|
|
617
|
+
]
|
|
398
618
|
})
|
|
619
|
+
|
|
620
|
+
// Result: NOTHING is pushed
|
|
621
|
+
// Error shows exactly what's wrong in BROKEN.promptl
|
|
622
|
+
// Fix the error, retry → all 10 push successfully
|
|
399
623
|
```
|
|
400
624
|
|
|
401
|
-
###
|
|
625
|
+
### Error Message Example
|
|
402
626
|
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
name: "sentiment-analyzer",
|
|
406
|
-
content: `---
|
|
407
|
-
provider: OpenAI
|
|
408
|
-
model: gpt-4o
|
|
409
|
-
temperature: 0
|
|
410
|
-
schema:
|
|
411
|
-
type: object
|
|
412
|
-
properties:
|
|
413
|
-
sentiment:
|
|
414
|
-
type: string
|
|
415
|
-
enum: [positive, negative, neutral]
|
|
416
|
-
required: [sentiment]
|
|
417
|
-
---
|
|
418
|
-
<system>
|
|
419
|
-
You are a sentiment analysis expert.
|
|
420
|
-
</system>
|
|
627
|
+
```
|
|
628
|
+
❌ Validation Failed - No Changes Made
|
|
421
629
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
630
|
+
1 prompt(s) have errors.
|
|
631
|
+
|
|
632
|
+
### my-prompt
|
|
633
|
+
Error Code: `message-tag-inside-message`
|
|
634
|
+
Error: Message tags cannot be inside of another message
|
|
635
|
+
Root Cause: Message/role tags cannot be nested inside each other.
|
|
636
|
+
Location: Line 107, Column 1
|
|
637
|
+
Code Context:
|
|
426
638
|
```
|
|
639
|
+
105: ## EXAMPLES
|
|
640
|
+
106:
|
|
641
|
+
107: <assistant>
|
|
427
642
|
|
|
428
|
-
|
|
643
|
+
^~~~~~~~~~~~
|
|
644
|
+
108: questions:
|
|
645
|
+
109: - id: q1
|
|
646
|
+
```
|
|
647
|
+
Fix: Move the nested tag outside its parent. Use code block (```yaml) instead.
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
### Supported Error Types
|
|
651
|
+
|
|
652
|
+
- `message-tag-inside-message` - Nested role tags
|
|
653
|
+
- `content-tag-inside-content` - Nested content tags
|
|
654
|
+
- `config-not-found` - Missing YAML frontmatter
|
|
655
|
+
- `invalid-config` - Malformed YAML
|
|
656
|
+
- `unclosed-block` - Missing closing tag
|
|
657
|
+
- `variable-not-defined` - Undefined variable
|
|
658
|
+
- `invalid-tool-call-placement` - Tool call outside `<assistant>`
|
|
659
|
+
- ...and more from official `promptl-ai` compiler
|
|
660
|
+
|
|
661
|
+
---
|
|
429
662
|
|
|
663
|
+
## 🔄 Migration Guide (v2 → v3)
|
|
664
|
+
|
|
665
|
+
### Tool Changes
|
|
666
|
+
|
|
667
|
+
| Old Tool (v2) | New Tool (v3) | Notes |
|
|
668
|
+
|---------------|---------------|-------|
|
|
669
|
+
| `append_prompts` | `add_prompt` | Always overwrites if exists (no `overwrite` param needed) |
|
|
670
|
+
| `replace_prompt` | `add_prompt` | Same behavior, unified tool |
|
|
671
|
+
|
|
672
|
+
**Migration:**
|
|
430
673
|
```javascript
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
})
|
|
674
|
+
// OLD (v2)
|
|
675
|
+
append_prompts({ filePaths: [...], overwrite: true })
|
|
676
|
+
replace_prompt({ filePath: "./prompt.promptl" })
|
|
435
677
|
|
|
436
|
-
//
|
|
678
|
+
// NEW (v3)
|
|
679
|
+
add_prompt({ filePaths: [...] }) // Always overwrites if exists
|
|
437
680
|
```
|
|
438
681
|
|
|
439
|
-
|
|
682
|
+
---
|
|
440
683
|
|
|
441
|
-
|
|
442
|
-
// Find topics about JSON
|
|
443
|
-
docs({ action: "find", query: "json output" })
|
|
684
|
+
## 🔧 Troubleshooting
|
|
444
685
|
|
|
445
|
-
|
|
446
|
-
|
|
686
|
+
### "Validation Failed" Errors
|
|
687
|
+
|
|
688
|
+
**Problem:** Prompt fails with nested tag error
|
|
689
|
+
|
|
690
|
+
**Solution:** The error shows exact location with code frame:
|
|
691
|
+
```
|
|
692
|
+
Error Code: `message-tag-inside-message`
|
|
693
|
+
Location: Line 4, Column 7
|
|
694
|
+
Code Context:
|
|
695
|
+
4: <user><assistant>Nested!</assistant></user>
|
|
696
|
+
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
697
|
+
Fix: Move the nested tag outside its parent.
|
|
447
698
|
```
|
|
448
699
|
|
|
700
|
+
Follow the fix suggestion - errors are LLM-actionable!
|
|
701
|
+
|
|
702
|
+
### "No Changes Made" After Push
|
|
703
|
+
|
|
704
|
+
**Problem:** `push_prompts` reports no changes
|
|
705
|
+
|
|
706
|
+
**Cause:** All prompts are already up to date (content matches LIVE)
|
|
707
|
+
|
|
708
|
+
**Solution:** This is normal - no action needed
|
|
709
|
+
|
|
710
|
+
### Version Naming Best Practices
|
|
711
|
+
|
|
712
|
+
**Good:**
|
|
713
|
+
- `feat/add-sentiment-analyzer`
|
|
714
|
+
- `fix/typo-in-greeting`
|
|
715
|
+
- `refactor/simplify-prompts`
|
|
716
|
+
- `docs/update-examples`
|
|
717
|
+
|
|
718
|
+
**Avoid:**
|
|
719
|
+
- `test` (too vague)
|
|
720
|
+
- `update` (what was updated?)
|
|
721
|
+
- `v1.2.3` (use semantic versioning elsewhere)
|
|
722
|
+
|
|
723
|
+
### Dynamic Descriptions Not Updating
|
|
724
|
+
|
|
725
|
+
**Problem:** Tool descriptions show old prompt list
|
|
726
|
+
|
|
727
|
+
**Cause:** Cache not refreshed (30s TTL)
|
|
728
|
+
|
|
729
|
+
**Solution:** Wait 30 seconds or restart MCP server
|
|
730
|
+
|
|
449
731
|
---
|
|
450
732
|
|
|
451
733
|
## Contributing
|