get-state-patterns
Retrieve state management patterns for React Native Expo projects using Zustand with MMKV persistence. Learn store setup, selectors, and organization rules for global state.
Instructions
Get state management patterns (Zustand + MMKV). Call this when creating a store or working with global state. Covers Zustand store setup, MMKV persistence adapter, selectors, useShallow, getState() for outside React, and store organization rules. Use topic to get a specific section only.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topic | No | Get a specific section only. Available: zustand, mmkv, mmkv-adapter, store-pattern, selectors, use-shallow, get-state, organization. Omit for full content. | |
| compact | No | If true, returns rules only without code examples. Much shorter. |
Implementation Reference
- The handler function that executes the `get-state-patterns` tool logic by calling the `resolvePattern` helper.
export const getStatePatterns = (topic?: string, compact?: boolean): string => resolvePattern(pattern, topic, compact); - src/index.ts:100-118 (schema)Tool definition and schema validation for `get-state-patterns` in `src/index.ts`.
server.tool( "get-state-patterns", "Get state management patterns (Zustand + MMKV). Call this when creating a store or working with global state. Covers Zustand store setup, MMKV persistence adapter, selectors, useShallow, getState() for outside React, and store organization rules. Use `topic` to get a specific section only.", { topic: z .string() .optional() .describe( "Get a specific section only. Available: zustand, mmkv, mmkv-adapter, store-pattern, selectors, use-shallow, get-state, organization. Omit for full content." ), compact: z .boolean() .optional() .describe("If true, returns rules only without code examples. Much shorter."), }, async ({ topic, compact }) => ({ content: [{ type: "text", text: getStatePatterns(topic, compact) }], }) ); - src/index.ts:100-101 (registration)Tool registration for `get-state-patterns` within the `McpServer` instance.
server.tool( "get-state-patterns",