Skip to main content
Glama

get_protocols

Retrieve stored protocols from Opentrons robots to manage and organize automation workflows. Filter by protocol type for efficient access.

Instructions

List all protocols stored on the robot

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
robot_ipYesRobot IP address
protocol_kindNoFilter by protocol type (optional)

Implementation Reference

  • The handler function that implements the get_protocols tool. It makes a GET request to the Opentrons robot's /protocols endpoint, optionally filters by protocol_kind, formats the list of protocols with details like ID, name, type, creation date, analysis status, and author, and returns a formatted text response.
    async getProtocols(args) {
      const { robot_ip, protocol_kind } = args;
      
      try {
        const data = await this.makeApiRequest(
          'GET',
          `http://${robot_ip}:31950/protocols`
        );
        
        let protocols = data.data || [];
        
        // Filter by kind if specified
        if (protocol_kind) {
          protocols = protocols.filter(p => p.protocolKind === protocol_kind);
        }
        
        if (protocols.length === 0) {
          return {
            content: [
              {
                type: "text",
                text: `No protocols found on robot${protocol_kind ? ` of type '${protocol_kind}'` : ''}.`
              }
            ]
          };
        }
        
        const protocolList = protocols.map(p => {
          const analysis = p.analysisSummaries?.[0];
          return `**${p.metadata?.protocolName || p.files[0]?.name || 'Unnamed Protocol'}**\n` +
                 `  ID: ${p.id}\n` +
                 `  Type: ${p.protocolKind || 'standard'}\n` +
                 `  Created: ${new Date(p.createdAt).toLocaleString()}\n` +
                 `  Analysis: ${analysis?.status || 'No analysis'}\n` +
                 `  Author: ${p.metadata?.author || 'Unknown'}\n`;
        }).join('\n');
        
        return {
          content: [
            {
              type: "text",
              text: `Found ${protocols.length} protocol${protocols.length !== 1 ? 's' : ''} on robot:\n\n${protocolList}`
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `❌ Failed to get protocols: ${error.message}`
            }
          ]
        };
      }
    }
  • The schema definition for the get_protocols tool, including input parameters: robot_ip (required string) and optional protocol_kind (enum: standard, quick-transfer). This is returned by the ListToolsRequestSchema handler.
    {
      name: "get_protocols", 
      description: "List all protocols stored on the robot",
      inputSchema: {
        type: "object",
        properties: {
          robot_ip: { type: "string", description: "Robot IP address" },
          protocol_kind: { type: "string", enum: ["standard", "quick-transfer"], description: "Filter by protocol type (optional)" }
        },
        required: ["robot_ip"]
      }
    },
  • index.js:252-253 (registration)
    The registration of the get_protocols handler in the CallToolRequestSchema switch statement, which dispatches to the getProtocols method.
    case "get_protocols":
      return this.getProtocols(args);
  • Helper method used by get_protocols (and other tools) to make authenticated HTTP requests to the Opentrons robot API, handling Opentrons-Version header, JSON parsing, and common error cases like connection refused.
    async makeApiRequest(method, url, headers = {}, body = null) {
      try {
        const options = {
          method,
          headers: {
            'Opentrons-Version': '*',
            ...headers
          }
        };
        
        if (body) {
          options.body = body;
        }
        
        const response = await fetch(url, options);
        const data = await response.json();
        
        if (!response.ok) {
          throw new Error(`API Error ${response.status}: ${data.message || JSON.stringify(data)}`);
        }
        
        return data;
      } catch (error) {
        if (error.code === 'ECONNREFUSED') {
          throw new Error(`Cannot connect to robot. Please check the IP address and ensure the robot is powered on.`);
        }
        throw error;
      }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions listing protocols but doesn't specify whether this is a read-only operation, if it requires authentication, what the output format is, or any rate limits. This leaves significant gaps in understanding the tool's behavior.

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?

The description is a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It is front-loaded and wastes no space, making it highly concise and well-structured.

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?

Given the lack of annotations and output schema, the description is incomplete. It doesn't cover behavioral aspects like safety, permissions, or output format, which are crucial for a tool that interacts with a robot. The description alone is insufficient for full contextual understanding.

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

Parameters3/5

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

The input schema has 100% description coverage, clearly documenting both parameters. The description adds no additional meaning beyond the schema, such as explaining the optionality of 'protocol_kind' or providing examples. Since the schema does the heavy lifting, the baseline score of 3 is appropriate.

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

Purpose4/5

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

The description clearly states the verb ('List') and resource ('protocols stored on the robot'), making the tool's function immediately understandable. However, it doesn't differentiate from sibling tools like 'list_by_category' or 'get_runs', which might also involve listing operations, so it doesn't fully distinguish itself from alternatives.

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?

The description provides no guidance on when to use this tool versus alternatives such as 'list_by_category' or 'get_runs', nor does it mention any prerequisites or exclusions. It simply states what the tool does without context for selection.

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/yerbymatey/opentrons-mcp'

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