mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
added mcp tools from routes
This commit is contained in:
@@ -26,6 +26,20 @@ export function omitKeys<T extends object, K extends keyof T>(
|
||||
return result;
|
||||
}
|
||||
|
||||
export function pickKeys<T extends object, K extends keyof T>(
|
||||
obj: T,
|
||||
keys_: readonly K[],
|
||||
): Pick<T, Extract<K, keyof T>> {
|
||||
const keys = new Set(keys_);
|
||||
const result = {} as Pick<T, Extract<K, keyof T>>;
|
||||
for (const [key, value] of Object.entries(obj) as [keyof T, T[keyof T]][]) {
|
||||
if (keys.has(key as K)) {
|
||||
(result as any)[key] = value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export function safelyParseObjectValues<T extends { [key: string]: any }>(obj: T): T {
|
||||
return Object.entries(obj).reduce((acc, [key, value]) => {
|
||||
try {
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
import * as s from "jsonv-ts";
|
||||
|
||||
export { validator as jsc, type Options } from "jsonv-ts/hono";
|
||||
export { describeRoute, schemaToSpec, openAPISpecs } from "jsonv-ts/hono";
|
||||
export { describeRoute, schemaToSpec, openAPISpecs, info } from "jsonv-ts/hono";
|
||||
export {
|
||||
mcp,
|
||||
McpServer,
|
||||
Resource,
|
||||
Tool,
|
||||
mcpTool,
|
||||
mcpResource,
|
||||
getMcpServer,
|
||||
type ToolAnnotation,
|
||||
type ToolHandlerCtx,
|
||||
} from "jsonv-ts/mcp";
|
||||
|
||||
Reference in New Issue
Block a user