@jaypie/mcp 0.7.26 → 0.7.27
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.
|
@@ -9,7 +9,7 @@ import { gt } from 'semver';
|
|
|
9
9
|
/**
|
|
10
10
|
* Docs Suite - Documentation services (skill, version, release_notes)
|
|
11
11
|
*/
|
|
12
|
-
const BUILD_VERSION_STRING = "@jaypie/mcp@0.7.
|
|
12
|
+
const BUILD_VERSION_STRING = "@jaypie/mcp@0.7.27#783c5da6"
|
|
13
13
|
;
|
|
14
14
|
const __filename$1 = fileURLToPath(import.meta.url);
|
|
15
15
|
const __dirname$1 = path.dirname(__filename$1);
|
package/package.json
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
version: 1.2.13
|
|
3
|
+
date: 2026-02-23
|
|
4
|
+
summary: Fix Gemini provider returning code-fenced JSON when format is specified
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Changes
|
|
8
|
+
|
|
9
|
+
- Strip markdown code fences from Gemini responses before JSON parsing when `format` or `response` is specified
|
|
10
|
+
- Fixes `operate()` path (GeminiAdapter) and `send()` path (GeminiProvider)
|
|
11
|
+
- Gemini sometimes returns `` ```json\n{...}\n``` `` despite `responseMimeType: "application/json"`
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Template string replacement with {{key}} syntax
|
|
3
|
+
related: llm, style, tests
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Placeholders
|
|
7
|
+
|
|
8
|
+
Replace `{{key}}` tokens in template strings with values from a data object. Supports nested paths and function templates.
|
|
9
|
+
|
|
10
|
+
## Import
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import { placeholders } from "@jaypie/kit";
|
|
14
|
+
// or
|
|
15
|
+
import { placeholders } from "jaypie";
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Signature
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
function placeholders(
|
|
22
|
+
template: string | (() => string),
|
|
23
|
+
data?: Record<string, unknown>,
|
|
24
|
+
): string
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Syntax
|
|
28
|
+
|
|
29
|
+
- Double curly braces: `{{key}}`
|
|
30
|
+
- Dot notation: `{{user.name}}`
|
|
31
|
+
- Bracket notation: `{{items[0].city}}`
|
|
32
|
+
- Whitespace trimmed: `{{ name }}` resolves same as `{{name}}`
|
|
33
|
+
- Unmatched keys remain: `{{missing}}` passes through unchanged
|
|
34
|
+
|
|
35
|
+
## Examples
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
// Simple replacement
|
|
39
|
+
placeholders("Hello, {{name}}!", { name: "Alice" });
|
|
40
|
+
// "Hello, Alice!"
|
|
41
|
+
|
|
42
|
+
// Nested paths
|
|
43
|
+
placeholders("Email: {{user.profile.email}}", {
|
|
44
|
+
user: { profile: { email: "alice@example.com" } },
|
|
45
|
+
});
|
|
46
|
+
// "Email: alice@example.com"
|
|
47
|
+
|
|
48
|
+
// Array access
|
|
49
|
+
placeholders("First: {{items[0]}}", { items: ["alpha", "beta"] });
|
|
50
|
+
// "First: alpha"
|
|
51
|
+
|
|
52
|
+
// Function template (lazy evaluation)
|
|
53
|
+
placeholders(() => `Generated at {{time}}`, { time: "12:00" });
|
|
54
|
+
// "Generated at 12:00"
|
|
55
|
+
|
|
56
|
+
// Missing keys pass through
|
|
57
|
+
placeholders("{{known}} and {{unknown}}", { known: "yes" });
|
|
58
|
+
// "yes and {{unknown}}"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## LLM Integration
|
|
62
|
+
|
|
63
|
+
`@jaypie/llm` applies placeholders to `input`, `instructions`, and `system` when `data` is provided.
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
import Llm from "@jaypie/llm";
|
|
67
|
+
|
|
68
|
+
const response = await Llm.operate("Summarize {{topic}}", {
|
|
69
|
+
model: "claude-sonnet-4",
|
|
70
|
+
data: { topic: "climate change" },
|
|
71
|
+
system: "You are an expert on {{topic}}",
|
|
72
|
+
instructions: "Focus on {{aspect}}",
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Placeholder Control Flags
|
|
77
|
+
|
|
78
|
+
Disable substitution per-field:
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
await Llm.operate("Hello {{name}}", {
|
|
82
|
+
data: { name: "Alice" },
|
|
83
|
+
placeholders: {
|
|
84
|
+
input: true, // default: true
|
|
85
|
+
instructions: true, // default: true
|
|
86
|
+
system: false, // skip system prompt substitution
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
All three default to `true` when `data` is provided.
|
|
92
|
+
|
|
93
|
+
## Testing
|
|
94
|
+
|
|
95
|
+
Mocked automatically via `@jaypie/testkit/mock` when mocking `jaypie` or `@jaypie/kit`.
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
vi.mock("jaypie", async () => import("@jaypie/testkit/mock"));
|
|
99
|
+
|
|
100
|
+
// The mock passes through with the same signature
|
|
101
|
+
import { placeholders } from "jaypie";
|
|
102
|
+
expect(placeholders("{{x}}", { x: "y" })).toBe("y");
|
|
103
|
+
```
|