Skip to content

Commit 6d58408

Browse files
fix(core): added muppet req in env
1 parent 2589a4b commit 6d58408

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

packages/core/src/muppet.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import type {
1414
BlankEnv,
1515
BlankSchema,
1616
Env,
17+
Input,
1718
Schema,
1819
ValidationTargets,
1920
} from "hono/types";
@@ -94,7 +95,7 @@ export function createMuppetServer<
9495
schema: _tool.schema,
9596
args: params.arguments,
9697
}),
97-
c.env,
98+
createMuppetEnv(c),
9899
);
99100

100101
const json = await res.json();
@@ -156,7 +157,7 @@ export function createMuppetServer<
156157
schema: prompt.schema,
157158
args: params.arguments,
158159
}),
159-
c.env,
160+
createMuppetEnv(c),
160161
);
161162

162163
const json = await res.json();
@@ -674,3 +675,14 @@ function querySerializer(
674675
}, [])
675676
.join("&");
676677
}
678+
679+
function createMuppetEnv<E extends Env, P extends string, I extends Input>(
680+
c: Context<E, P, I>,
681+
) {
682+
return {
683+
...c.env,
684+
muppet: {
685+
req: c.req,
686+
},
687+
};
688+
}

packages/core/src/types.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import type {
88
ImageContentSchema,
99
TextContentSchema,
1010
} from "@modelcontextprotocol/sdk/types.js";
11-
import type { Env, Hono, Schema, ValidationTargets } from "hono";
12-
import type { BlankEnv, BlankSchema } from "hono/types";
11+
import type { Env, Hono, HonoRequest, Schema, ValidationTargets } from "hono";
12+
import type { BlankEnv, BlankInput, BlankSchema, Input } from "hono/types";
1313

1414
export type HasUndefined<T> = undefined extends T ? true : false;
1515

@@ -218,3 +218,10 @@ export type PromptResponseType =
218218
messages: PromptContentResponseType[];
219219
}
220220
| PromptContentResponseType[];
221+
222+
export type MuppetEnv<
223+
P extends string = string,
224+
I extends Input = BlankInput,
225+
> = {
226+
req: HonoRequest<P, I>;
227+
};

0 commit comments

Comments
 (0)