@amalgm/tools 0.1.7-preview.34938534039 → 0.1.7-preview.35132305560

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/PURPOSE.md CHANGED
@@ -43,6 +43,10 @@ and parity evidence only.
43
43
 
44
44
  ## Axioms
45
45
 
46
+ MCP execution context belongs to each host-admitted call. It passes unchanged
47
+ to the driver, never comes from model-supplied arguments or metadata, and never
48
+ leaks between concurrent calls sharing a prepared Toolbox view.
49
+
46
50
  Consumer assembly derives exact same-branch dependency pins from the declared
47
51
  package manifests and registry candidate records. One pending composition per
48
52
  branch preserves human edits; complete consumer checks for the exact merge tree govern its
@@ -14,7 +14,7 @@ declare function createMcpServer<T extends Toolbox | ToolboxView = Toolbox>(opti
14
14
  mcp?: McpOptions;
15
15
  }): {
16
16
  toolbox: T;
17
- handle: (request: Request) => Promise<unknown>;
17
+ handle: (request: Request, context?: unknown) => Promise<unknown>;
18
18
  start: (input?: Readable, output?: Writable) => readline.Interface;
19
19
  };
20
20
  export { createMcpServer };
@@ -8,7 +8,8 @@ function descriptor(tool) {
8
8
  function createMcpServer(options = {}) {
9
9
  const toolbox = options.toolbox || new Toolbox(options);
10
10
  const mcpOptions = options.mcp || {};
11
- async function handle(request) {
11
+ /** Context is supplied by the trusted transport host, never parsed from MCP input. */
12
+ async function handle(request, context) {
12
13
  if (request.method === 'initialize') {
13
14
  return {
14
15
  protocolVersion: request.params?.protocolVersion || '2024-11-05',
@@ -23,7 +24,7 @@ function createMcpServer(options = {}) {
23
24
  return { tools: tools.map(descriptor) };
24
25
  if (request.method === 'tools/call') {
25
26
  try {
26
- return await callMcpTool(toolbox, String(request.params?.name || ''), request.params?.arguments || {}, mcpOptions);
27
+ return await callMcpTool(toolbox, String(request.params?.name || ''), request.params?.arguments || {}, context === undefined ? mcpOptions : { ...mcpOptions, context });
27
28
  }
28
29
  catch (error) {
29
30
  if (error instanceof Error && error.message.startsWith('Unknown tool:')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amalgm/tools",
3
- "version": "0.1.7-preview.34938534039",
3
+ "version": "0.1.7-preview.35132305560",
4
4
  "description": "Local-first tool definitions, Toolbox registry, and agent execution surfaces.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -88,11 +88,11 @@
88
88
  "package.json"
89
89
  ]
90
90
  },
91
- "gitHead": "f5da1898ae08a6531db09197968c1a7134b209f8",
91
+ "gitHead": "5f61d1c4c9e5eeff976708c7afb7ec615d6d1aab",
92
92
  "amalgmSource": {
93
93
  "repository": "amalgm-inc/amalgm-tools",
94
94
  "branch": "preview",
95
- "commit": "f5da1898ae08a6531db09197968c1a7134b209f8",
96
- "occurrence": "34938534039"
95
+ "commit": "5f61d1c4c9e5eeff976708c7afb7ec615d6d1aab",
96
+ "occurrence": "35132305560"
97
97
  }
98
98
  }