mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-15 20:17:22 +00:00
@@ -21,6 +21,29 @@ export function McpTool({ tool }: { tool: ReturnType<Tool["toJSON"]> }) {
|
||||
);
|
||||
}
|
||||
|
||||
const getType = (value: JSONSchemaDefinition) => {
|
||||
if (value === undefined || value === null) {
|
||||
return "any";
|
||||
}
|
||||
|
||||
if (value.type) {
|
||||
if (Array.isArray(value.type)) {
|
||||
return value.type.join(" | ");
|
||||
}
|
||||
return value.type;
|
||||
}
|
||||
|
||||
if ("anyOf" in value) {
|
||||
return value.anyOf.map(getType).join(" | ");
|
||||
}
|
||||
|
||||
if ("oneOf" in value) {
|
||||
return value.oneOf.map(getType).join(" | ");
|
||||
}
|
||||
|
||||
return "any";
|
||||
};
|
||||
|
||||
export function JsonSchemaTypeTable({ schema }: { schema: JSONSchemaDefinition }) {
|
||||
const properties = schema.properties ?? {};
|
||||
const required = schema.required ?? [];
|
||||
@@ -44,8 +67,8 @@ export function JsonSchemaTypeTable({ schema }: { schema: JSONSchemaDefinition }
|
||||
typeDescription: (
|
||||
<DynamicCodeBlock lang="json" code={indent(getTypeDescription(value), 1)} />
|
||||
),
|
||||
type: value.type,
|
||||
default: value.default ? JSON.stringify(value.default) : undefined,
|
||||
type: getType(value),
|
||||
default: value.default !== undefined ? JSON.stringify(value.default) : undefined,
|
||||
required: required.includes(key),
|
||||
},
|
||||
]),
|
||||
|
||||
16
docs/components/misc/Wrapper.tsx
Normal file
16
docs/components/misc/Wrapper.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { cn } from "@/lib/cn";
|
||||
import type { HTMLAttributes } from "react";
|
||||
|
||||
export function Wrapper(props: HTMLAttributes<HTMLDivElement>) {
|
||||
return (
|
||||
<div
|
||||
{...props}
|
||||
className={cn(
|
||||
"rounded-lg bg-radial-[at_bottom] from-fd-primary/10 p-4 border bg-origin-border border-fd-accent-primary/10 prose-no-margin dark:bg-black/20",
|
||||
props.className,
|
||||
)}
|
||||
>
|
||||
{props.children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user