Skip to main content
Glama
samber

Go Playground MCP Server

by samber

execute_go_playground_url

Run Go code from any Go Playground URL in the sandbox, with optional vet check. Provide the URL and receive execution results.

Instructions

Execute Go code from an existing Go Playground URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe Go Playground URL to execute code from (e.g., https://go.dev/play/abc123 or https://play.golang.org/p/abc123)
withVetNoWhether to run go vet on the code (default: true)

Implementation Reference

  • Handler function that orchestrates the execute_go_playground_url tool: extracts url and withVet from args, calls client.executeUrl(), and formats the response.
    const createExecuteGoPlaygroundUrlHandler =
      (client: ReturnType<typeof createGoPlaygroundClient>) =>
      async (args: ExecuteGoPlaygroundUrlArgs): Promise<MCPToolResponse> => {
        try {
          const { url, withVet = true } = args;
          const result = await client.executeUrl(url, withVet);
          const responseText = formatRunResponse(result);
          return createSuccessResponse(responseText);
        } catch (error) {
          console.error('Error in handleExecuteGoPlaygroundUrl:', error);
          return createErrorResponse(error);
        }
      };
  • Type definition for ExecuteGoPlaygroundUrlArgs with readonly url (GoPlaygroundUrl) and optional withVet boolean.
    export type ExecuteGoPlaygroundUrlArgs = {
      readonly url: GoPlaygroundUrl;
      readonly withVet?: boolean;
    };
  • Type guard function isExecuteGoPlaygroundUrlArgs that validates runtime arguments have a valid playground URL and optionally a boolean withVet.
    export const isExecuteGoPlaygroundUrlArgs = (
      args: unknown
    ): args is ExecuteGoPlaygroundUrlArgs => {
      return (
        typeof args === 'object' &&
        args !== null &&
        'url' in args &&
        isGoPlaygroundUrl((args as Record<string, unknown>).url) &&
        (!('withVet' in args) ||
          typeof (args as Record<string, unknown>).withVet === 'boolean')
      );
  • Tool registration with name 'execute_go_playground_url', description, and inputSchema defining url (string) and withVet (optional boolean) parameters.
      {
        name: TOOL_NAMES.EXECUTE_GO_PLAYGROUND_URL,
        description: 'Execute Go code from an existing Go Playground URL',
        inputSchema: {
          type: 'object',
          properties: {
            url: {
              type: 'string',
              description: 'The Go Playground URL to execute code from (e.g., https://go.dev/play/abc123 or https://play.golang.org/p/abc123)',
            },
            withVet: {
              type: 'boolean',
              description: 'Whether to run go vet on the code (default: true)',
              default: true,
            },
          },
          required: ['url'],
        },
      },
    ] as const;
  • Core implementation: reads code from a playground URL using readGoPlaygroundUrl, then executes it using runGoCode with the withVet option.
    // Function to execute code from playground URL
    export const executeGoPlaygroundUrl =
      (config: Partial<GoPlaygroundConfig> = {}) =>
      async (url: string, withVet: boolean = true): Promise<MCPGoPlaygroundResult> => {
        // First read the code from the URL
        const readResult = await readGoPlaygroundUrl(config)(url);
        if (!readResult.success) {
          return {
            success: false,
            errors: readResult.error,
          };
        }
    
        // Then execute the code
        const runCode = runGoCode(config);
        return await runCode(readResult.code, withVet);
      };
Behavior2/5

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

With no annotations, the description should disclose behavioral traits. It only says 'execute' but does not explain side effects, network requirements, or whether the execution is remote and has latency. The agent is left guessing about key behaviors.

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

Conciseness4/5

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

The description is a single, clear sentence with no unnecessary words. It is appropriately sized for the simple function, though a bit more detail could improve it.

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 output schema and annotations, the description should complete the picture. It fails to indicate the return value (e.g., whether it returns output, errors, or status). This is a significant gap for a tool that executes code.

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?

Schema covers both parameters fully (100%), so baseline is 3. The description adds no extra context about the parameters beyond what the schema provides.

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 action (execute Go code) and the resource (existing Go Playground URL). It distinguishes from siblings like 'read' or 'share' by specifying execution from a URL. However, it does not mention what the tool returns, leaving some ambiguity.

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. It does not specify prerequisites, limitations, or situations where another sibling tool (e.g., run_go_code without a URL) is more appropriate.

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/samber/go-playground-mcp'

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