retrieve_field_plugins
Retrieve field plugins by context (space, org, partner), filter by ownership or name, and paginate results.
Instructions
Retrieves multiple field plugins (field types) across different contexts.
Args: context (str): 'space', 'org', or 'partner' only_mine (int): 1 = only plugins created by authenticated user page (int): pagination page number per_page (int): plugins per page (max 100) search (str): search filter for plugin name or slug
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context | No | Context: 'space', 'org', or 'partner' | space |
| only_mine | No | 1 = only plugins created by authenticated user | |
| page | No | Pagination page number | |
| per_page | No | Plugins per page (max 100) | |
| search | No | Search filter for plugin name or slug |
Implementation Reference
- src/tools/field-plugins.ts:41-73 (handler)Handler function that executes the 'retrieve_field_plugins' tool logic. Builds URL with query params (context, only_mine, page, per_page, search), performs a GET request to the Storyblok Management API, and returns the response.
async ({ context, only_mine, page, per_page, search }) => { try { const baseUrl = `${FIELD_PLUGIN_URLS[context]}/`; const params: Record<string, string> = {}; if (only_mine !== undefined) { params.only_mine = String(only_mine); } if (page !== undefined) { params.page = String(page); } if (per_page !== undefined) { params.per_page = String(per_page); } if (search !== undefined) { params.search = search; } const url = buildUrlWithParams(baseUrl, params); const response = await fetch(url, { method: 'GET', headers: getManagementHeaders(), }); const data = await handleResponse(response, url); return createJsonResponse(data); } catch (error) { if (error instanceof APIError) { return createErrorResponse(error); } throw error; } } ); - src/tools/field-plugins.ts:34-40 (schema)Zod schema defining input parameters: context (enum: space/org/partner), only_mine, page, per_page, and search.
{ context: z.enum(['space', 'org', 'partner']).default('space').describe("Context: 'space', 'org', or 'partner'"), only_mine: z.number().optional().default(1).describe('1 = only plugins created by authenticated user'), page: z.number().optional().default(1).describe('Pagination page number'), per_page: z.number().optional().default(25).describe('Plugins per page (max 100)'), search: z.string().optional().describe('Search filter for plugin name or slug'), }, - src/tools/field-plugins.ts:22-73 (registration)Registration via server.tool('retrieve_field_plugins', ...) inside the registerFieldPlugins function.
export function registerFieldPlugins(server: McpServer): void { // Tool: retrieve_field_plugins server.tool( 'retrieve_field_plugins', `Retrieves multiple field plugins (field types) across different contexts. Args: context (str): 'space', 'org', or 'partner' only_mine (int): 1 = only plugins created by authenticated user page (int): pagination page number per_page (int): plugins per page (max 100) search (str): search filter for plugin name or slug`, { context: z.enum(['space', 'org', 'partner']).default('space').describe("Context: 'space', 'org', or 'partner'"), only_mine: z.number().optional().default(1).describe('1 = only plugins created by authenticated user'), page: z.number().optional().default(1).describe('Pagination page number'), per_page: z.number().optional().default(25).describe('Plugins per page (max 100)'), search: z.string().optional().describe('Search filter for plugin name or slug'), }, async ({ context, only_mine, page, per_page, search }) => { try { const baseUrl = `${FIELD_PLUGIN_URLS[context]}/`; const params: Record<string, string> = {}; if (only_mine !== undefined) { params.only_mine = String(only_mine); } if (page !== undefined) { params.page = String(page); } if (per_page !== undefined) { params.per_page = String(per_page); } if (search !== undefined) { params.search = search; } const url = buildUrlWithParams(baseUrl, params); const response = await fetch(url, { method: 'GET', headers: getManagementHeaders(), }); const data = await handleResponse(response, url); return createJsonResponse(data); } catch (error) { if (error instanceof APIError) { return createErrorResponse(error); } throw error; } } ); - src/tools/field-plugins.ts:16-20 (helper)Base URL mappings for field plugins by context (space, org, partner).
const FIELD_PLUGIN_URLS: Record<string, string> = { space: 'https://mapi.storyblok.com/v1/field_types', org: 'https://mapi.storyblok.com/v1/org_field_types', partner: 'https://mapi.storyblok.com/v1/partner_field_types', }; - src/tools/index.ts:103-103 (registration)Top-level registration call: registerFieldPlugins(server) in the registerAllTools function.
registerFieldPlugins(server);