Skip to main content
Glama

Storyden

by Southclaws
Mozilla Public License 2.0
229
page.tsx1.71 kB
import z from "zod"; import { categoryList } from "@/api/openapi-server/categories"; import { threadList } from "@/api/openapi-server/threads"; import { UnreadyBanner } from "@/components/site/Unready"; import { CategoryIndexScreen } from "@/screens/category/CategoryIndexScreen"; type Props = { searchParams: Promise<Query>; }; const QuerySchema = z.object({ page: z .string() .transform((v) => parseInt(v, 10)) .optional(), }); type Query = z.infer<typeof QuerySchema>; export default async function Page({ searchParams }: Props) { try { const { page } = QuerySchema.parse(await searchParams); const { data: categories } = await categoryList(); const { data: threads } = await threadList({ page: page?.toString() ?? "1", // NOTE: The string "null" is a special case that yields all threads that // do not have a category. Why a string null and not just null? Because // the OpenAPI generators don't play well with query parameters that use // an algebraic type like string[] | null. We even tried using an array // with a string like string[] | string where the second string is set // to filter against the regex "^null$" but that also didn't work. So, // simply dumb solution: backend checks for a list item of "null". Lol. categories: ["null"], }); return ( <CategoryIndexScreen layout={"list"} threadListMode="uncategorised" showQuickShare={true} initialCategoryList={categories} initialThreadList={threads} initialThreadListPage={page} paginationBasePath="/d" /> ); } catch (e) { return <UnreadyBanner error={e} />; } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Southclaws/storyden'

If you have feedback or need assistance with the MCP directory API, please join our Discord server