Skip to main content
Glama
code-alchemist01

MCP Cloud Services Server

stop_resource

Stop cloud resources like instances or functions on AWS, Azure, or GCP to manage costs and control resource usage.

Instructions

Stop a cloud resource

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
providerYesCloud provider
resourceIdYesResource ID to stop
resourceTypeYesResource type

Implementation Reference

  • The core handler logic for the 'stop_resource' tool within the switch statement of handleResourceManagementTool. It extracts resourceId and resourceType, checks if it's an AWS EC2 instance, calls AWSAdapter.stopEC2Instance if supported, returns success message, otherwise throws an implementation-not-found error.
    case 'stop_resource': {
      const resourceId = params.resourceId as string;
      const resourceType = params.resourceType as string;
    
      if (provider === 'aws' && resourceType === 'instance') {
        const adapter = new AWSAdapter();
        await adapter.stopEC2Instance(resourceId);
        return { success: true, message: `Instance ${resourceId} stopped` };
      }
      throw new Error(`Stop operation not yet implemented for ${provider} ${resourceType}`);
    }
  • Tool metadata and input schema definition for 'stop_resource', specifying parameters for cloud provider, resource ID, and type (instance or function). This object is part of the exported resourceManagementTools array.
    {
      name: 'stop_resource',
      description: 'Stop a cloud resource',
      inputSchema: {
        type: 'object',
        properties: {
          provider: {
            type: 'string',
            enum: ['aws', 'azure', 'gcp'],
            description: 'Cloud provider',
          },
          resourceId: {
            type: 'string',
            description: 'Resource ID to stop',
          },
          resourceType: {
            type: 'string',
            enum: ['instance', 'function'],
            description: 'Resource type',
          },
        },
        required: ['provider', 'resourceId', 'resourceType'],
      },
    },
  • src/server.ts:19-27 (registration)
    Includes resourceManagementTools (containing 'stop_resource' schema) in the complete allTools array, which is returned in ListToolsResponse for MCP clients to discover available tools.
    const allTools = [
      ...awsTools,
      ...azureTools,
      ...gcpTools,
      ...resourceManagementTools,
      ...costAnalysisTools,
      ...monitoringTools,
      ...securityTools,
    ];
  • src/server.ts:70-71 (registration)
    Dispatch routing in the MCP server's CallToolRequest handler: checks if the tool name matches one in resourceManagementTools and invokes handleResourceManagementTool, which contains the stop_resource case.
    } else if (resourceManagementTools.some((t) => t.name === name)) {
      result = await handleResourceManagementTool(name, args || {});

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/code-alchemist01/Cloud-mcp_server'

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