@dwlf/mcp-server 0.64.1 → 0.65.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/dist/blockDescriptions.d.ts +20 -0
- package/dist/blockDescriptions.d.ts.map +1 -0
- package/dist/blockDescriptions.js +123 -0
- package/dist/blockDescriptions.js.map +1 -0
- package/dist/profiles.d.ts +5 -4
- package/dist/profiles.d.ts.map +1 -1
- package/dist/profiles.js +28 -20
- package/dist/profiles.js.map +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Block-profile tool wording (DWLF-835; Andy, 12-Nov-2026 17:53). Block describes conditions, never calls, and
|
|
4
|
+
* its profile has no strategies, strategy signals or backtests. A shared tool whose `full` description speaks of
|
|
5
|
+
* strategy entries/exits, stop-losses, backtests or "triggers" gets its Block wording here; `profiledServer` sends it
|
|
6
|
+
* in place of the shared one when the profile is `block`. The shared description, which retail still uses, is unchanged.
|
|
7
|
+
* Parameters say things too, so a tool can also have its Block input schema (BLOCK_SCHEMAS: strategy-only parameters
|
|
8
|
+
* removed, wording changed) and, where its OUTPUT would carry strategy nodes, a Block handler (BLOCK_HANDLERS).
|
|
9
|
+
* A test reads what the built server actually lists under `--profile block` and keeps all of it free of that
|
|
10
|
+
* vocabulary and of references to tools Block hides.
|
|
11
|
+
*/
|
|
12
|
+
type Shape = Record<string, z.ZodTypeAny>;
|
|
13
|
+
type Handler = (args: Record<string, unknown>, extra: unknown) => unknown;
|
|
14
|
+
/** A string replaces the shared description; a function rewrites it (for a one-phrase change). */
|
|
15
|
+
export declare const BLOCK_DESCRIPTIONS: Readonly<Record<string, string | ((shared: string) => string)>>;
|
|
16
|
+
/** Block input schemas: each takes the shared shape and returns Block's. */
|
|
17
|
+
export declare const BLOCK_SCHEMAS: Readonly<Record<string, (shared: Shape) => Shape>>;
|
|
18
|
+
export declare const BLOCK_HANDLERS: Readonly<Record<string, (shared: Handler) => Handler>>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=blockDescriptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blockDescriptions.d.ts","sourceRoot":"","sources":["../src/blockDescriptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;GASG;AACH,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC;AAC1C,KAAK,OAAO,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;AAE1E,kGAAkG;AAClG,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC,CAoE7F,CAAC;AAWH,4EAA4E;AAC5E,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,KAAK,KAAK,CAAC,CAqB3E,CAAC;AAOH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,CAehF,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** A string replaces the shared description; a function rewrites it (for a one-phrase change). */
|
|
3
|
+
export const BLOCK_DESCRIPTIONS = Object.freeze({
|
|
4
|
+
dwlf_update_subscription: 'Update an existing alert subscription (PATCH). Only the fields you supply change; everything else is kept. ' +
|
|
5
|
+
'Most used: toggle `enabled` to pause/resume without losing the subscription\'s history. Editable fields: enabled, ' +
|
|
6
|
+
'symbols, timeframes, channels, quietHours, dedupeWindowMinutes, and customEventId (custom_event subscriptions ' +
|
|
7
|
+
'only). `eventTypeId` is NOT patchable: switching what an alert listens for means delete + recreate.',
|
|
8
|
+
dwlf_get_ranges: (shared) => shared.replace(' "at the TOP of the range — think twice about entering here",', ' "at the TOP of the range",'),
|
|
9
|
+
dwlf_create_subscription: 'Create an alert subscription: get told when an event fires. Two shapes, distinguished by `eventTypeId`:\n' +
|
|
10
|
+
' - any event id (e.g. `onchain.mvrv.cross_above_1`, `cycle.low.confirmed`, `swing_low_break`): fires when that event is recorded;\n' +
|
|
11
|
+
' - `custom_event`: requires `customEventId`; fires when that custom event fires.\n\n' +
|
|
12
|
+
'`symbols` controls scope: an array of symbols, or `[\'*\']` for every symbol the account follows. `timeframes` accepts ' +
|
|
13
|
+
'`[\'1d\']`, `[\'1w\']`, or `[\'*\']` for any. `channels` is an array of delivery destinations, currently ' +
|
|
14
|
+
'`{ type: \'telegram\', destination: { chatId: <id> }, enabled: true }`. An alert says what happened and when; it is ' +
|
|
15
|
+
'not a recommendation. A plan limits how many alerts an account may have, and which event families it may alert on.',
|
|
16
|
+
dwlf_describe_strategy_nodes: 'Describe the nodes a custom event is built from: condition nodes (what each one checks, its parameters and their ' +
|
|
17
|
+
'engine defaults) and the logic gates that combine them (and/or/not/then). Optional `nodeType` filters to one node; ' +
|
|
18
|
+
'`category: "condition"` or `"logic"` lists one kind in full. Indicator/event condition nodes come from the platform\'s node catalogue (GET /v2/node-types, cached up to 15 ' +
|
|
19
|
+
'minutes; an unfiltered call lists them by name, ask by nodeType or category "condition" for detail), marked ' +
|
|
20
|
+
'`source: "catalogue"` with `label`, `direction`, `timeframes` (the only ones the node fires on) and ' +
|
|
21
|
+
'`catalogueCategory`. When `honoredByExecutor: false` on a param, the listed `default` is the only value the engine ' +
|
|
22
|
+
'uses; `honoredByExecutor: null` means not verified (the parameter reaches the compiled event; its effect is not ' +
|
|
23
|
+
'checked here). A node with `engineIgnored` is one the engine cannot evaluate: do not use it. `engineIgnores` is the raw rule ' +
|
|
24
|
+
'list ({ id } or { prefix }, with a reason). `catalogueError` means the catalogue could not be read and only the ' +
|
|
25
|
+
'static nodes are listed.',
|
|
26
|
+
dwlf_create_custom_event: '⚠️ Create a new custom event (a condition you define, recorded each time it holds). WORKFLOW: 1) create → 2) compile ' +
|
|
27
|
+
'→ 3) MUST call dwlf_activate_event_symbols (or the event will never fire) → 4) dwlf_evaluate_custom_event to fill ' +
|
|
28
|
+
'its history. Until symbols are activated the event exists but the evaluation engine does not see it, so it records ' +
|
|
29
|
+
'nothing. Activate symbols straight after creating it.',
|
|
30
|
+
dwlf_evaluate_custom_event: '⚠️ Trigger an on-demand evaluation run for a custom event: the step BETWEEN activating symbols and reading its fires. ' +
|
|
31
|
+
'Without it the event only evaluates on the daily run, and its history is not filled until then. Returns ' +
|
|
32
|
+
'{ requestId, status: "pending" }; poll dwlf_get_evaluation_status(requestId) until status is "completed", then read ' +
|
|
33
|
+
'the fires via dwlf_get_events(type: "custom_event"). Consumes one EVALUATION quota. By default only the most recent ' +
|
|
34
|
+
'~400 candles (~14 months of daily data) are evaluated, so older history has NO fires: to fill a longer history pass ' +
|
|
35
|
+
'`lookbackDays` covering it (e.g. 2200 for ~5-6 years).',
|
|
36
|
+
dwlf_activate_event_symbols: '⚠️ REQUIRED STEP after creating a custom event: activate (enable) symbols for it. An event does NOT evaluate until ' +
|
|
37
|
+
'symbols are activated: the daily run skips it and it records no fires. If an event shows no fires, check this step ' +
|
|
38
|
+
'first. Call straight after compiling an event.',
|
|
39
|
+
dwlf_get_evaluation_status: 'Get the status and result summary of an evaluation by requestId. Poll this after dwlf_evaluate_custom_event until ' +
|
|
40
|
+
'status === "completed". ⚠️ `summary.totalItems` / `summary.processedItems` count evaluation-JOB items (one per ' +
|
|
41
|
+
'custom event), NOT the symbols inside the job: an evaluation across 37 symbols shows `totalItems: 1, ' +
|
|
42
|
+
'processedItems: 1` when done. When the request named symbols this tool adds `symbolsRequested: <count>` beside the ' +
|
|
43
|
+
'summary. When status is "completed", read the fires via dwlf_get_events(type: "custom_event").',
|
|
44
|
+
dwlf_register_agent: 'Programmatically register a new DWLF account: no browser or Google sign-in required. Returns an API key ' +
|
|
45
|
+
'immediately. Email verification unlocks the compute features (custom event evaluations). Useful for onboarding ' +
|
|
46
|
+
'flows where an agent registers itself.',
|
|
47
|
+
dwlf_get_cycle_setups: 'The cycle screener: across the symbols DWLF tracks, which have their WEEKLY cycle timing window open, and whether a ' +
|
|
48
|
+
'DAILY cycle pivot has confirmed inside it, for lows and highs alike. Stages: `confirmed_setup` (weekly window open ' +
|
|
49
|
+
'AND a daily pivot confirmed within 15 days), `awaiting_confirmation` (daily pivot provisional, confidence % ' +
|
|
50
|
+
'included), `window_open` (window open, no daily pivot yet). Each row: weekly window position (early/mid/late + ' +
|
|
51
|
+
'days since the last pivot), `weekly.timing`, the daily pivot\'s price/confidence/age, last close and % from the ' +
|
|
52
|
+
'pivot. The counts per side describe how many symbols are in each state; they are a description, not a forecast. ' +
|
|
53
|
+
'`weekly.timing` is the STORED weekly window, the same edges the chart draws: `earliest`, `opens`, `closes`, ' +
|
|
54
|
+
'`hardMax` (dated edges), `phase` (upcoming | open | overdue | missed), `n`, `calibration`, `verification` (always ' +
|
|
55
|
+
'`unverified` while the detection gate stands failed), `rulerAgreesWithState`, `generation` and `projectionHash`; ' +
|
|
56
|
+
'null when no window is stored for the series. ⚠️ A symbol whose weekly window is not yet open is ABSENT from every ' +
|
|
57
|
+
'list: for its window dates call `dwlf_get_cycle_windows`. DEPTH (`depth: true`): each row also carries `depth`, ' +
|
|
58
|
+
'its weekly window\'s price band from past cycles\' moves (the same object `dwlf_get_cycle_windows` returns), and ' +
|
|
59
|
+
'`depth.reading.position` places the last weekly close: `in-zone` (inside the p25–p75 of past moves), `shallow` / ' +
|
|
60
|
+
'`deep` / `beyond`, or `not-reached`. It is context, not a target, and it does not change the stage or the order. ' +
|
|
61
|
+
'A missing band says why in `depthUnavailable`. Everything here is a dated state of the cycle engine, not a call.',
|
|
62
|
+
});
|
|
63
|
+
const BLOCK_EVENT_TYPE_ID = 'What fires the alert: an event id (e.g. `onchain.mvrv.cross_above_1`, `cycle.low.confirmed`), or ' +
|
|
64
|
+
'`custom_event` with `customEventId`.';
|
|
65
|
+
const withoutStrategyParams = (shape, eventTypeId) => {
|
|
66
|
+
const { strategyId: _a, mode: _b, riskPerTradeOverride: _c, accountBalanceOverride: _d, maxConcurrentTradesOverride: _e, ...rest } = shape;
|
|
67
|
+
void _a;
|
|
68
|
+
void _b;
|
|
69
|
+
void _c;
|
|
70
|
+
void _d;
|
|
71
|
+
void _e;
|
|
72
|
+
return eventTypeId && rest.eventTypeId ? { ...rest, eventTypeId } : rest;
|
|
73
|
+
};
|
|
74
|
+
/** Block input schemas: each takes the shared shape and returns Block's. */
|
|
75
|
+
export const BLOCK_SCHEMAS = Object.freeze({
|
|
76
|
+
dwlf_create_subscription: (shared) => withoutStrategyParams(shared, z.string().describe(BLOCK_EVENT_TYPE_ID)),
|
|
77
|
+
dwlf_update_subscription: (shared) => withoutStrategyParams(shared),
|
|
78
|
+
dwlf_evaluate_custom_event: (shared) => ({
|
|
79
|
+
...shared,
|
|
80
|
+
lookbackDays: z.number().int().positive().optional().describe('How many days of history to (re)evaluate, overriding the ' +
|
|
81
|
+
'default ~400-candle (~14-month) window. Set it to cover the whole history you want the event\'s fires for.'),
|
|
82
|
+
}),
|
|
83
|
+
dwlf_get_cycle_windows: (shared) => ({
|
|
84
|
+
...shared,
|
|
85
|
+
side: z.enum(['low', 'high']).optional().describe('Omit for both sides. `low` = the next cycle-low window; `high` = the next cycle-high window.'),
|
|
86
|
+
}),
|
|
87
|
+
dwlf_get_evaluation_status: (shared) => ({
|
|
88
|
+
...shared,
|
|
89
|
+
requestId: z.string().describe('Evaluation request ID returned by dwlf_evaluate_custom_event'),
|
|
90
|
+
}),
|
|
91
|
+
dwlf_describe_strategy_nodes: (shared) => ({
|
|
92
|
+
...shared,
|
|
93
|
+
nodeType: z.string().optional().describe('Return only this one node (a condition or a logic gate, by its node type id).'),
|
|
94
|
+
category: z.enum(['condition', 'logic']).optional().describe('`condition` (indicator and event conditions) or `logic` (the and/or/not/then gates that combine them).'),
|
|
95
|
+
}),
|
|
96
|
+
});
|
|
97
|
+
// What a Block custom event is built from: condition nodes and the logic gates that combine them (and/or/not/then).
|
|
98
|
+
// Entry signals, stop-losses, take-profits, exits and cancellations are strategy nodes, which Block does not have.
|
|
99
|
+
const BLOCK_NODE_CATEGORIES = new Set(['condition', 'logic']);
|
|
100
|
+
export const BLOCK_HANDLERS = Object.freeze({
|
|
101
|
+
// The shared answer (brief by default, in full for a category or a nodeType), with strategy nodes taken out. A
|
|
102
|
+
// nodeType lookup that finds only a strategy node is refused rather than described.
|
|
103
|
+
dwlf_describe_strategy_nodes: (shared) => async (args, extra) => {
|
|
104
|
+
const res = (await shared(args, extra));
|
|
105
|
+
if (res.isError) {
|
|
106
|
+
return res;
|
|
107
|
+
}
|
|
108
|
+
let parsed;
|
|
109
|
+
try {
|
|
110
|
+
parsed = JSON.parse(res.content?.[0]?.text ?? '{}');
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
return res;
|
|
114
|
+
}
|
|
115
|
+
const nodes = (parsed.nodes ?? []).filter((n) => BLOCK_NODE_CATEGORIES.has(String(n.category)));
|
|
116
|
+
if (args.nodeType && nodes.length === 0) {
|
|
117
|
+
return { isError: true, content: [{ type: 'text', text: JSON.stringify({ error: `Not a custom-event node: ${String(args.nodeType)}`,
|
|
118
|
+
hint: 'Block custom events are built from condition nodes and logic gates; call with no arguments to list them.' }, null, 2) }] };
|
|
119
|
+
}
|
|
120
|
+
return { content: [{ type: 'text', text: JSON.stringify({ ...parsed, count: nodes.length, nodes }, null, 2) }] };
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
//# sourceMappingURL=blockDescriptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blockDescriptions.js","sourceRoot":"","sources":["../src/blockDescriptions.ts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AAC;YAAC,OAAO,GAAG,CAAC;QAAC,CAAC;QAClF,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,qBAAqB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAChG,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,4BAA4B,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;4BACjI,IAAI,EAAE,0GAA0G,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QACtI,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;IACnH,CAAC;CACF,CAAC,CAAC"}
|
package/dist/profiles.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
/**
|
|
3
3
|
* Tool profiles (DWLF-621). `full` (the default) registers every tool, exactly as before. `block` registers the
|
|
4
|
-
* curated subset for Bitcoin users of block.dwlf: conditions, on-chain events, custom events,
|
|
5
|
-
*
|
|
4
|
+
* curated subset for Bitcoin users of block.dwlf: conditions, on-chain events, custom events, alerts and the
|
|
5
|
+
* academy (no strategy signals, strategies or backtests: DWLF-835). A Block user's agent then doesn't see ~100 retail and metals tools.
|
|
6
6
|
*
|
|
7
7
|
* Selected by `--profile <name>` or `DWLF_TOOL_PROFILE`; the flag wins. An unknown name is a startup error, never a
|
|
8
8
|
* silent fallback to `full`: an agent configured for Block must not quietly get the whole catalogue.
|
|
9
9
|
*
|
|
10
|
-
* A profile
|
|
10
|
+
* A profile HIDES tools and, for `block`, rewords some (description, input schema, and the node catalogue's answer:
|
|
11
|
+
* src/blockDescriptions.ts, DWLF-835). Every request still goes through the same API key and the same backend
|
|
11
12
|
* permissions, quotas and licensing, so a profile is never a security boundary.
|
|
12
13
|
*/
|
|
13
14
|
export type ProfileName = 'full' | 'block';
|
|
@@ -17,7 +18,7 @@ export declare const PROFILE_INSTRUCTIONS: Record<ProfileName, string | null>;
|
|
|
17
18
|
/** The profile named by `--profile X` / `--profile=X`, else `DWLF_TOOL_PROFILE`, else `full`. Throws on an unknown name. */
|
|
18
19
|
export declare function resolveProfile(argv: readonly string[], env: Record<string, string | undefined>): ProfileName;
|
|
19
20
|
/**
|
|
20
|
-
* A view of `server` that registers only the profile's tools. Resources, prompts and everything else pass
|
|
21
|
+
* A view of `server` that registers only the profile's tools, and for `block` sends their Block wording (blockArgs). Resources, prompts and everything else pass
|
|
21
22
|
* through unchanged. `registered` collects every tool name offered, including the hidden ones, so a test can
|
|
22
23
|
* check that each profile tool exists.
|
|
23
24
|
*/
|
package/dist/profiles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC;AAM3C,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,MAAM,CAkD1C,CAAC;AAIH,sFAAsF;AACtF,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAcnE,CAAC;AAEF,4HAA4H;AAC5H,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,WAAW,CAgB5G;AAwBD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,GAAE,GAAG,CAAC,MAAM,CAAa,GAAG,SAAS,CAgBtH"}
|
package/dist/profiles.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BLOCK_DESCRIPTIONS, BLOCK_SCHEMAS, BLOCK_HANDLERS } from './blockDescriptions.js';
|
|
1
2
|
// Profile names are a published contract (server.json `choices`, client configs in docs/BLOCK.md): a name is never
|
|
2
3
|
// removed. A retired or split profile keeps its old name as an alias here, mapped to its successor.
|
|
3
4
|
const PROFILE_ALIASES = {};
|
|
@@ -37,24 +38,9 @@ export const BLOCK_TOOLS = new Set([
|
|
|
37
38
|
'dwlf_deactivate_event_symbols',
|
|
38
39
|
'dwlf_get_event_symbols',
|
|
39
40
|
'dwlf_get_custom_event_notifications',
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
'dwlf_create_strategy',
|
|
44
|
-
'dwlf_update_strategy',
|
|
45
|
-
'dwlf_compile_strategy',
|
|
46
|
-
'dwlf_delete_strategy',
|
|
47
|
-
'dwlf_evaluate_strategy',
|
|
48
|
-
'dwlf_get_recent_signals',
|
|
49
|
-
'dwlf_activate_strategy_symbols',
|
|
50
|
-
'dwlf_deactivate_strategy_symbols',
|
|
51
|
-
'dwlf_get_strategy_symbols',
|
|
52
|
-
'dwlf_run_backtest',
|
|
53
|
-
'dwlf_get_backtest_results',
|
|
54
|
-
'dwlf_get_backtest_summary',
|
|
55
|
-
'dwlf_list_backtests',
|
|
56
|
-
'dwlf_cancel_backtest',
|
|
57
|
-
'dwlf_delete_backtest',
|
|
41
|
+
// NOT in Block (Andy, 12-Nov-2026 17:53, DWLF-835): strategy signals, strategies and backtests, with their
|
|
42
|
+
// signal/entry/exit vocabulary. Block describes conditions, never calls; they stay in `full` and are revisited for
|
|
43
|
+
// Block with the builder in v1.1.
|
|
58
44
|
// Alerts
|
|
59
45
|
'dwlf_list_subscriptions',
|
|
60
46
|
'dwlf_create_subscription',
|
|
@@ -107,7 +93,29 @@ export function resolveProfile(argv, env) {
|
|
|
107
93
|
throw new Error(`Unknown DWLF tool profile "${raw}". Use one of: ${Object.keys(PROFILES).join(', ')}.`);
|
|
108
94
|
}
|
|
109
95
|
/**
|
|
110
|
-
* A
|
|
96
|
+
* A shared tool's registration as the Block profile sends it (DWLF-835): its Block description, input schema and
|
|
97
|
+
* handler where it has them. Registrations are `server.tool(name, description, shape, handler)`; any other form is
|
|
98
|
+
* refused here rather than passed through unchanged, so an override can never be silently skipped.
|
|
99
|
+
*/
|
|
100
|
+
function blockArgs(name, args) {
|
|
101
|
+
const text = BLOCK_DESCRIPTIONS[name];
|
|
102
|
+
const schema = BLOCK_SCHEMAS[name];
|
|
103
|
+
const handler = BLOCK_HANDLERS[name];
|
|
104
|
+
if (text === undefined && schema === undefined && handler === undefined)
|
|
105
|
+
return args;
|
|
106
|
+
if (args.length !== 4 || typeof args[1] !== 'string' || typeof args[2] !== 'object' || typeof args[3] !== 'function') {
|
|
107
|
+
throw new Error(`${name}: has Block wording, but is not registered as tool(name, description, shape, handler)`);
|
|
108
|
+
}
|
|
109
|
+
const [, description, shape, fn] = args;
|
|
110
|
+
return [
|
|
111
|
+
name,
|
|
112
|
+
typeof text === 'function' ? text(description) : (text ?? description),
|
|
113
|
+
schema ? schema(shape) : shape,
|
|
114
|
+
handler ? handler(fn) : fn,
|
|
115
|
+
];
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* A view of `server` that registers only the profile's tools, and for `block` sends their Block wording (blockArgs). Resources, prompts and everything else pass
|
|
111
119
|
* through unchanged. `registered` collects every tool name offered, including the hidden ones, so a test can
|
|
112
120
|
* check that each profile tool exists.
|
|
113
121
|
*/
|
|
@@ -121,7 +129,7 @@ export function profiledServer(server, profile, registered = new Set()) {
|
|
|
121
129
|
registered.add(name);
|
|
122
130
|
if (allowed && !allowed.has(name))
|
|
123
131
|
return undefined;
|
|
124
|
-
return target.tool.apply(target, args);
|
|
132
|
+
return target.tool.apply(target, profile === 'block' ? blockArgs(name, args) : args);
|
|
125
133
|
};
|
|
126
134
|
}
|
|
127
135
|
const value = Reflect.get(target, prop, receiver);
|
package/dist/profiles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAgB3F,mHAAmH;AACnH,oGAAoG;AACpG,MAAM,eAAe,GAAgC,EAAE,CAAC;AAExD,MAAM,CAAC,MAAM,WAAW,GAAwB,IAAI,GAAG,CAAC;IACtD,yBAAyB;IACzB,qBAAqB;IACrB,8BAA8B;IAC9B,oBAAoB;IACpB,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;IAChB,wBAAwB;IACxB,gBAAgB;IAChB,wBAAwB;IACxB,sBAAsB;IACtB,6BAA6B;IAC7B,uBAAuB;IACvB,sHAAsH;IACtH,sHAAsH;IACtH,iHAAiH;IACjH,qHAAqH;IACrH,qBAAqB;IACrB,qBAAqB;IACrB,iBAAiB;IACjB,kDAAkD;IAClD,8BAA8B;IAC9B,yBAAyB;IACzB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,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gBACzH,CAAC,CAAC;YACJ,CAAC;YACD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;YAClD,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAClE,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dwlf/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.65.0",
|
|
4
4
|
"mcpName": "uk.co.dwlf/mcp-server",
|
|
5
5
|
"description": "MCP server for DWLF market analysis platform — exposes market data, indicators, signals, strategies, backtests, portfolio, trade journal, and more as AI-accessible tools",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"start": "node dist/index.js",
|
|
19
19
|
"dev": "tsx src/index.ts",
|
|
20
20
|
"prepublishOnly": "npm run build",
|
|
21
|
-
"test": "npm run build && node --test test/*.test.mjs"
|
|
21
|
+
"test": "npm run build && node --test test/*.test.mjs",
|
|
22
|
+
"eval": "npm run build && node eval/run.mjs"
|
|
22
23
|
},
|
|
23
24
|
"keywords": [
|
|
24
25
|
"mcp",
|
|
@@ -53,6 +54,7 @@
|
|
|
53
54
|
"zod": "^4.3.6"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
57
|
+
"@anthropic-ai/sdk": "^1.8.0",
|
|
56
58
|
"@types/node": "^25.1.0",
|
|
57
59
|
"tsx": "^4.21.0",
|
|
58
60
|
"typescript": "^5.9.3"
|