get-api-patterns
Retrieve API and data fetching patterns for React Native Expo projects, including Axios client setup, service organization, and TanStack Query hooks. Use topic parameter to access specific sections like query keys or mutation hooks.
Instructions
Get API and data fetching patterns (Axios + TanStack Query). Call this when creating API services or data fetching hooks. Covers Axios client with interceptors, domain-grouped services, custom query/mutation hooks, query key conventions, and QueryClient config. Use topic to get a specific section only.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topic | No | Get a specific section only. Available: axios-client, services, query-hooks, mutation-hooks, usage, v4-vs-v5, query-keys, query-client-config, rules. Omit for full content. | |
| compact | No | If true, returns rules only without code examples. Much shorter. |
Implementation Reference
- The handler function that retrieves API patterns based on the requested topic and whether a compact version is needed.
export const getApiPatterns = (topic?: string, compact?: boolean): string => resolvePattern(pattern, topic, compact); - src/index.ts:123-141 (registration)The registration of the `get-api-patterns` tool in the MCP server.
server.tool( "get-api-patterns", "Get API and data fetching patterns (Axios + TanStack Query). Call this when creating API services or data fetching hooks. Covers Axios client with interceptors, domain-grouped services, custom query/mutation hooks, query key conventions, and QueryClient config. Use `topic` to get a specific section only.", { topic: z .string() .optional() .describe( "Get a specific section only. Available: axios-client, services, query-hooks, mutation-hooks, usage, v4-vs-v5, query-keys, query-client-config, rules. 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: getApiPatterns(topic, compact) }], }) );