latitude-mcp-server 3.2.0 → 3.2.2
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/PROMPT_GUIDE.md +380 -0
- package/package.json +1 -1
package/PROMPT_GUIDE.md
ADDED
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Complete guide for LLMs to autonomously manage, test, and optimize PromptL prompts via MCP
|
|
3
|
+
auto_execution_mode: 3
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# LATITUDE MCP SERVER - LLM AUTONOMOUS GUIDE
|
|
7
|
+
|
|
8
|
+
> "File-first workflow: Pull → Edit → Push → Test → Iterate"
|
|
9
|
+
|
|
10
|
+
## GOLDEN RULE: FILE PATHS ONLY
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
❌ NEVER: Write prompt content directly in tool calls
|
|
14
|
+
✅ ALWAYS: Create .promptl files, use filePaths parameter
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Why?** Files are versionable, editable, reviewable. Inline content is messy and hard to iterate.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## THE 7 TOOLS
|
|
22
|
+
|
|
23
|
+
| Tool | Purpose | Key Param |
|
|
24
|
+
|------|---------|-----------|
|
|
25
|
+
| `list_prompts` | See what exists | — |
|
|
26
|
+
| `get_prompt` | Read prompt content | `name` |
|
|
27
|
+
| `run_prompt` | Execute with params | `name`, `parameters` |
|
|
28
|
+
| `pull_prompts` | Download all → `./prompts/` | `outputDir?` |
|
|
29
|
+
| `add_prompt` | Add/update (never deletes) | `filePaths` ✅ |
|
|
30
|
+
| `push_prompts` | Replace ALL (FULL SYNC) | `filePaths` ✅ |
|
|
31
|
+
| `docs` | Learn PromptL | `action`, `query`/`topic` |
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## FILE-FIRST WORKFLOW
|
|
36
|
+
|
|
37
|
+
### Step 1: Pull
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{ "tool": "pull_prompts" }
|
|
41
|
+
```
|
|
42
|
+
Creates `./prompts/*.promptl`
|
|
43
|
+
|
|
44
|
+
### Step 2: Create/Edit File
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Create new file
|
|
48
|
+
echo '---
|
|
49
|
+
provider: openai
|
|
50
|
+
model: gpt-4o
|
|
51
|
+
temperature: 0.2
|
|
52
|
+
---
|
|
53
|
+
<user>Extract email from: {{ text }}</user>' > ./prompts/email-extractor.promptl
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Step 3: Push via File Path
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"tool": "add_prompt",
|
|
61
|
+
"filePaths": ["./prompts/email-extractor.promptl"],
|
|
62
|
+
"versionName": "feat/add-email-extractor"
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Step 4: Test
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"tool": "run_prompt",
|
|
71
|
+
"name": "email-extractor",
|
|
72
|
+
"parameters": { "text": "Contact john@example.com" }
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Step 5: Iterate
|
|
77
|
+
|
|
78
|
+
Edit file → `add_prompt` again → `run_prompt` → repeat until quality is perfect
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 📚 LEARN PROMPTL WITH `docs` TOOL
|
|
83
|
+
|
|
84
|
+
### How to Use
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{ "tool": "docs", "action": "help" } // Overview of all 52 topics
|
|
88
|
+
{ "tool": "docs", "action": "find", "query": "json schema" } // Search
|
|
89
|
+
{ "tool": "docs", "action": "get", "topic": "config-json-output" } // Get specific
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Learning Menu: "To build X, call Y"
|
|
93
|
+
|
|
94
|
+
| I want to... | Call this |
|
|
95
|
+
|--------------|-----------|
|
|
96
|
+
| **Understand PromptL basics** | `docs(action: "get", topic: "overview")` |
|
|
97
|
+
| **Learn file structure** | `docs(action: "get", topic: "structure")` |
|
|
98
|
+
| **Use variables** | `docs(action: "get", topic: "variables")` |
|
|
99
|
+
| **Add conditionals (if/else)** | `docs(action: "get", topic: "conditionals")` |
|
|
100
|
+
| **Loop through items** | `docs(action: "get", topic: "loops")` |
|
|
101
|
+
|
|
102
|
+
| I want to... | Call this |
|
|
103
|
+
|--------------|-----------|
|
|
104
|
+
| **Configure provider/model** | `docs(action: "get", topic: "config-basics")` |
|
|
105
|
+
| **Get JSON output (schema)** | `docs(action: "get", topic: "config-json-output")` |
|
|
106
|
+
| **Set temperature/tokens** | `docs(action: "get", topic: "config-generation")` |
|
|
107
|
+
| **Use OpenAI models** | `docs(action: "get", topic: "providers-openai")` |
|
|
108
|
+
| **Use Anthropic models** | `docs(action: "get", topic: "providers-anthropic")` |
|
|
109
|
+
|
|
110
|
+
| I want to... | Call this |
|
|
111
|
+
|--------------|-----------|
|
|
112
|
+
| **Write system/user/assistant** | `docs(action: "get", topic: "messages-roles")` |
|
|
113
|
+
| **Use images (multimodal)** | `docs(action: "get", topic: "messages-multimodal")` |
|
|
114
|
+
|
|
115
|
+
| I want to... | Call this |
|
|
116
|
+
|--------------|-----------|
|
|
117
|
+
| **Add few-shot examples** | `docs(action: "get", topic: "technique-few-shot")` |
|
|
118
|
+
| **Chain of thought reasoning** | `docs(action: "get", topic: "technique-cot")` |
|
|
119
|
+
| **Build agents with tools** | `docs(action: "get", topic: "agents")` |
|
|
120
|
+
| **Define custom tools** | `docs(action: "get", topic: "tools-custom")` |
|
|
121
|
+
| **Multi-step chains** | `docs(action: "get", topic: "chains")` |
|
|
122
|
+
|
|
123
|
+
| I want to build... | Call this |
|
|
124
|
+
|--------------------|-----------|
|
|
125
|
+
| **Data extraction** | `docs(action: "get", topic: "recipe-extraction")` |
|
|
126
|
+
| **Classification** | `docs(action: "get", topic: "recipe-classification")` |
|
|
127
|
+
| **Chatbot** | `docs(action: "get", topic: "recipe-chatbot")` |
|
|
128
|
+
| **RAG system** | `docs(action: "get", topic: "recipe-rag")` |
|
|
129
|
+
| **Content moderation** | `docs(action: "get", topic: "recipe-moderation")` |
|
|
130
|
+
|
|
131
|
+
### Quick Search Examples
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
// Don't know exact topic? Search!
|
|
135
|
+
{ "tool": "docs", "action": "find", "query": "extract structured data" }
|
|
136
|
+
{ "tool": "docs", "action": "find", "query": "few shot examples" }
|
|
137
|
+
{ "tool": "docs", "action": "find", "query": "agent autonomous" }
|
|
138
|
+
{ "tool": "docs", "action": "find", "query": "loop array items" }
|
|
139
|
+
{ "tool": "docs", "action": "find", "query": "temperature settings" }
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## 🎯 DYNAMIC TOOL DESCRIPTIONS
|
|
145
|
+
|
|
146
|
+
**No need to call `list_prompts` first!**
|
|
147
|
+
|
|
148
|
+
`run_prompt` description shows:
|
|
149
|
+
```
|
|
150
|
+
Available prompts (10):
|
|
151
|
+
- email-extractor (params: text)
|
|
152
|
+
- sentiment (params: input, language)
|
|
153
|
+
- cover-letter (params: job_details, patterns, company)
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
`add_prompt` description shows:
|
|
157
|
+
```
|
|
158
|
+
Available prompts (10): email-extractor, sentiment, cover-letter, ...
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**Check tool description → know what exists + what params needed**
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## AUTONOMOUS ITERATION LOOP
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
1. Learn pattern → docs(action: "find", query: "...")
|
|
169
|
+
2. Create file → ./prompts/my-prompt.promptl
|
|
170
|
+
3. Push → add_prompt(filePaths: [...], versionName: "v1")
|
|
171
|
+
4. Test → run_prompt(name: "...", parameters: {...})
|
|
172
|
+
5. Analyze output → Good? Done. Bad? Continue.
|
|
173
|
+
6. Edit file → Improve based on output analysis
|
|
174
|
+
7. Re-push → add_prompt(filePaths: [...], versionName: "v2")
|
|
175
|
+
8. Re-test → run_prompt again
|
|
176
|
+
9. Repeat 5-8 → Until quality threshold met
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## BULK TESTING WITH MCP INSPECTOR
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
# Test single prompt
|
|
185
|
+
npx @modelcontextprotocol/inspector \
|
|
186
|
+
-e LATITUDE_API_KEY=$KEY -e LATITUDE_PROJECT_ID=$ID \
|
|
187
|
+
--cli npx -y latitude-mcp-server@3.2.1 \
|
|
188
|
+
--method tools/call \
|
|
189
|
+
--tool-name run_prompt \
|
|
190
|
+
--tool-arg name=email-extractor \
|
|
191
|
+
--tool-arg 'parameters={"text":"john@example.com"}'
|
|
192
|
+
|
|
193
|
+
# Test multiple prompts in loop
|
|
194
|
+
for p in email-extractor sentiment classifier; do
|
|
195
|
+
echo "=== $p ===" && npx @modelcontextprotocol/inspector \
|
|
196
|
+
-e LATITUDE_API_KEY=$KEY -e LATITUDE_PROJECT_ID=$ID \
|
|
197
|
+
--cli npx -y latitude-mcp-server@3.2.1 \
|
|
198
|
+
--method tools/call --tool-name run_prompt \
|
|
199
|
+
--tool-arg name=$p --tool-arg 'parameters={"text":"test"}'
|
|
200
|
+
done
|
|
201
|
+
|
|
202
|
+
# Analyze outputs → update weak prompts → re-test
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## VERSION NAMING
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
feat/add-email-extractor # New feature
|
|
211
|
+
fix/improve-accuracy # Bug fix
|
|
212
|
+
refactor/simplify-prompt # Cleanup
|
|
213
|
+
perf/reduce-tokens # Performance
|
|
214
|
+
test/add-examples # Testing
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Omit → auto-generates timestamp
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## SYNC BEHAVIOR
|
|
222
|
+
|
|
223
|
+
| Tool | Behavior |
|
|
224
|
+
|------|----------|
|
|
225
|
+
| `add_prompt` | ADDITIVE - adds/updates, never deletes |
|
|
226
|
+
| `push_prompts` | FULL SYNC - replaces ALL, deletes extras |
|
|
227
|
+
| `pull_prompts` | FULL SYNC - deletes local first |
|
|
228
|
+
|
|
229
|
+
**Use `add_prompt` for normal work. Use `push_prompts` only for reset/init.**
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## VALIDATION
|
|
234
|
+
|
|
235
|
+
All writes validate BEFORE API calls:
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
❌ Validation Failed
|
|
239
|
+
|
|
240
|
+
Error Code: `message-tag-inside-message`
|
|
241
|
+
Location: Line 4, Column 7
|
|
242
|
+
Code Context:
|
|
243
|
+
4: <user><assistant>Nested!</assistant></user>
|
|
244
|
+
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
245
|
+
Fix: Move nested tag outside parent.
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**Fix file → re-push → validation passes**
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## PROMPTL QUICK REFERENCE
|
|
253
|
+
|
|
254
|
+
### Basic Structure
|
|
255
|
+
|
|
256
|
+
```yaml
|
|
257
|
+
---
|
|
258
|
+
provider: openai
|
|
259
|
+
model: gpt-4o
|
|
260
|
+
temperature: 0.2
|
|
261
|
+
---
|
|
262
|
+
<system>You are a helpful assistant.</system>
|
|
263
|
+
<user>{{ user_input }}</user>
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### With Schema (JSON Output)
|
|
267
|
+
|
|
268
|
+
```yaml
|
|
269
|
+
---
|
|
270
|
+
provider: openai
|
|
271
|
+
model: gpt-4o
|
|
272
|
+
schema:
|
|
273
|
+
type: object
|
|
274
|
+
properties:
|
|
275
|
+
result: { type: string }
|
|
276
|
+
required: [result]
|
|
277
|
+
---
|
|
278
|
+
<user>{{ input }}</user>
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### Few-Shot Examples
|
|
282
|
+
|
|
283
|
+
```yaml
|
|
284
|
+
---
|
|
285
|
+
provider: openai
|
|
286
|
+
model: gpt-4o
|
|
287
|
+
---
|
|
288
|
+
<user>Classify: Great product!</user>
|
|
289
|
+
<assistant>positive</assistant>
|
|
290
|
+
|
|
291
|
+
<user>Classify: Terrible experience</user>
|
|
292
|
+
<assistant>negative</assistant>
|
|
293
|
+
|
|
294
|
+
<user>Classify: {{ text }}</user>
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Temperature Guide
|
|
298
|
+
|
|
299
|
+
```
|
|
300
|
+
0.0-0.2 Deterministic (extraction, classification)
|
|
301
|
+
0.3-0.5 Balanced (Q&A, analysis)
|
|
302
|
+
0.6-0.8 Creative (writing, brainstorming)
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## COMPLETE EXAMPLE: BUILD EMAIL EXTRACTOR
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
# 1. Learn JSON schema pattern
|
|
311
|
+
docs(action: "get", topic: "config-json-output")
|
|
312
|
+
|
|
313
|
+
# 2. Create file
|
|
314
|
+
cat > ./prompts/email-extractor.promptl << 'EOF'
|
|
315
|
+
---
|
|
316
|
+
provider: openai
|
|
317
|
+
model: gpt-4o
|
|
318
|
+
temperature: 0.1
|
|
319
|
+
schema:
|
|
320
|
+
type: object
|
|
321
|
+
properties:
|
|
322
|
+
email: { type: string }
|
|
323
|
+
name: { type: [string, "null"] }
|
|
324
|
+
required: [email]
|
|
325
|
+
---
|
|
326
|
+
<system>
|
|
327
|
+
Extract email and name. Return null for name if not found.
|
|
328
|
+
</system>
|
|
329
|
+
<user>{{ text }}</user>
|
|
330
|
+
EOF
|
|
331
|
+
|
|
332
|
+
# 3. Push
|
|
333
|
+
add_prompt(filePaths: ["./prompts/email-extractor.promptl"], versionName: "v1")
|
|
334
|
+
|
|
335
|
+
# 4. Test
|
|
336
|
+
run_prompt(name: "email-extractor", parameters: { text: "John at john@example.com" })
|
|
337
|
+
|
|
338
|
+
# 5. Output not good? Edit file, re-push as v2, re-test
|
|
339
|
+
# 6. Repeat until perfect
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
## ANTI-PATTERNS
|
|
345
|
+
|
|
346
|
+
| ❌ Don't | ✅ Do |
|
|
347
|
+
|----------|-------|
|
|
348
|
+
| Write content in tool call | Create .promptl file, use filePaths |
|
|
349
|
+
| Guess PromptL syntax | `docs(action: "find", query: "...")` |
|
|
350
|
+
| Call list_prompts first | Check run_prompt tool description |
|
|
351
|
+
| Use push_prompts casually | Use add_prompt (safer) |
|
|
352
|
+
| Skip testing | run_prompt after every change |
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
## QUICK COMMANDS
|
|
357
|
+
|
|
358
|
+
```
|
|
359
|
+
"What prompts exist?" → Check run_prompt description (dynamic)
|
|
360
|
+
"What params does X need?" → Check run_prompt description (dynamic)
|
|
361
|
+
"Learn about schemas" → docs(action: "get", topic: "config-json-output")
|
|
362
|
+
"Search for X" → docs(action: "find", query: "X")
|
|
363
|
+
"Add my file" → add_prompt(filePaths: ["./prompts/x.promptl"])
|
|
364
|
+
"Test prompt" → run_prompt(name: "x", parameters: {...})
|
|
365
|
+
"Pull all prompts" → pull_prompts
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## WISDOM
|
|
371
|
+
|
|
372
|
+
**File-First:** "Never write prompt content in tool calls. Always use filePaths."
|
|
373
|
+
|
|
374
|
+
**Learn-First:** "docs(find) → docs(get) → create file → push → test"
|
|
375
|
+
|
|
376
|
+
**Iterate:** "Edit file → add_prompt → run_prompt → analyze → repeat"
|
|
377
|
+
|
|
378
|
+
**Dynamic:** "Tool descriptions show prompts + params. No listing needed."
|
|
379
|
+
|
|
380
|
+
**Validate:** "Client-side validation catches errors before API calls."
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "latitude-mcp-server",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "Simplified MCP server for Latitude.so prompt management - 8 focused tools for push, pull, run, and manage prompts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|