fetch_space_roles
Retrieve space roles from a Storyblok space, filtered by search query or specific IDs, to manage user permissions and access levels.
Instructions
Retrieves multiple space roles for a given space.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| search | No | Search query for filtering roles | |
| by_ids | No | Filter by specific role IDs |
Implementation Reference
- src/tools/space-roles.ts:19-38 (handler)Handler function for fetch_space_roles: builds query params from optional 'search' and 'by_ids' inputs, then calls apiGet('/space_roles/', params) to retrieve space roles from the Storyblok API.
async ({ search, by_ids }) => { try { const params: Record<string, string> = {}; if (search !== undefined) { params.search = search; } if (by_ids !== undefined && by_ids.length > 0) { params.by_ids = by_ids.join(','); } const data = await apiGet('/space_roles/', params); return createJsonResponse(data); } catch (error) { if (error instanceof APIError) { return createErrorResponse(error); } throw error; } } ); - src/tools/space-roles.ts:15-18 (schema)Input schema for fetch_space_roles: optional 'search' (string) and optional 'by_ids' (array of numbers) for filtering.
{ search: z.string().optional().describe('Search query for filtering roles'), by_ids: z.array(z.number()).optional().describe('Filter by specific role IDs'), }, - src/tools/space-roles.ts:12-13 (registration)MCP tool registration for fetch_space_roles via server.tool() call inside registerSpaceRoles().
server.tool( 'fetch_space_roles', - src/tools/index.ts:69-69 (registration)Registration call for the space-roles module in the aggregator registerAllTools function.
registerSpaceRoles(server); - src/tools/space-roles.ts:10-10 (registration)Exported registration function that registers all space role tools including fetch_space_roles.
export function registerSpaceRoles(server: McpServer): void {