Skip to main content
Glama

scope_set_default

Set the default store view scope for the current Magento session to control which store views are affected by subsequent operations.

Instructions

Set the default store view scope for the current session.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsNoAction parameters as a JSON object

Implementation Reference

  • The handler for 'scope.set_default'. Uses ScopeSetDefaultSchema to validate params, then sets the default scope via sessionStore.setDefaultScope().
    {
      name: 'scope.set_default',
      description: 'Set the default store view scope for the current session.',
      riskTier: RiskTier.Safe,
      requiresAuth: true,
      handler: async (params: Record<string, unknown>, context: ActionContext) => {
        const validated = ScopeSetDefaultSchema.parse(params);
    
        sessionStore.setDefaultScope(context.sessionId, {
          store_view_code: validated.store_view_code,
        });
    
        return {
          message: `Default scope set to store view: ${validated.store_view_code}`,
          store_view_code: validated.store_view_code,
        };
      },
  • Zod schema for scope_set_default: requires a store_view_code string of min length 1.
    export const ScopeSetDefaultSchema = z.object({
      store_view_code: z.string().min(1),
    });
  • src/index.ts:51-53 (registration)
    Registration: createScopeActions is called in main() and its returned ActionDefinitions (including scope.set_default) are collected into allActions array.
    const allActions: ActionDefinition[] = [
      ...createAuthActions(sessionStore),
      ...createScopeActions(sessionStore),
  • Factory function that creates scope actions (including scope.set_default), registering them as ActionDefinition objects.
    export function createScopeActions(sessionStore: SessionStore): ActionDefinition[] {
      return [
        {
          name: 'scope.list_websites_stores',
          description: 'List all websites, stores, and store views configured in Magento.',
          riskTier: RiskTier.Safe,
          requiresAuth: true,
          handler: async (_params: Record<string, unknown>, context: ActionContext) => {
            const client = context.getClient();
    
            // Fetch store configs to get websites/stores/views
            const storeConfigs = await client.get<unknown[]>('/V1/store/storeConfigs');
            const websites = await client.get<unknown[]>('/V1/store/websites');
            const storeGroups = await client.get<unknown[]>('/V1/store/storeGroups');
            const storeViews = await client.get<unknown[]>('/V1/store/storeViews');
    
            return {
              websites,
              store_groups: storeGroups,
              store_views: storeViews,
              store_configs: storeConfigs,
              default_scope: context.getDefaultScope(),
            };
          },
        },
        {
          name: 'scope.set_default',
          description: 'Set the default store view scope for the current session.',
          riskTier: RiskTier.Safe,
          requiresAuth: true,
          handler: async (params: Record<string, unknown>, context: ActionContext) => {
            const validated = ScopeSetDefaultSchema.parse(params);
    
            sessionStore.setDefaultScope(context.sessionId, {
              store_view_code: validated.store_view_code,
            });
    
            return {
              message: `Default scope set to store view: ${validated.store_view_code}`,
              store_view_code: validated.store_view_code,
            };
          },
        },
      ];
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided. The description only states the intention without disclosing behavioral details like side effects (e.g., overwriting previous scope), idempotency, or authentication requirements. The agent lacks essential safety context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence with no unnecessary words. Concise and front-loaded with the action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple setter tool with a vague parameter and no output schema, the description is incomplete. It fails to explain how to specify the scope or what the outcome looks like, requiring the agent to guess or infer from sibling tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The 'params' parameter is an object with additionalProperties: {}, providing no structure. The description does not explain what keys or values are expected (e.g., scope code, store view ID). The schema's description is also vague, leaving the parameter completely underspecified.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action (set), resource (default store view scope), and context (current session). It distinguishes from sibling tools like scope_list_websites_stores (which lists scopes) and other unrelated tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs alternatives like scope_list_websites_stores. No prerequisites or exclusions are mentioned, leaving the agent without context for proper invocation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

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/thomastx05/magento-mcp'

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