Skip to main content
Glama
InsForge

Insforge MCP Server

get-function

Retrieve details and code for a specific edge function using its slug identifier. This tool helps developers access function information from the Insforge backend platform.

Instructions

Get details of a specific edge function including its code

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
slugYesThe slug identifier of the function

Implementation Reference

  • Full registration of the 'get-function' MCP tool, including description, Zod input schema, and handler wrapped with usage tracking.
    server.tool(
      'get-function',
      'Get details of a specific edge function including its code',
      {
        slug: z.string().describe('The slug identifier of the function'),
      },
      withUsageTracking('get-function', async (args) => {
        try {
          const response = await fetch(`${API_BASE_URL}/api/functions/${args.slug}`, {
            method: 'GET',
            headers: {
              'x-api-key': getApiKey(),
            },
          });
    
          const result = await handleApiResponse(response);
    
          return await addBackgroundContext({
            content: [
              {
                type: 'text',
                text: formatSuccessMessage(`Edge function '${args.slug}' details`, result),
              },
            ],
          });
        } catch (error) {
          const errMsg = error instanceof Error ? error.message : 'Unknown error occurred';
          return {
            content: [
              {
                type: 'text',
                text: `Error getting function: ${errMsg}`,
              },
            ],
            isError: true,
          };
        }
      })
    );
  • Core handler logic for 'get-function': performs authenticated GET request to backend API /api/functions/{slug}, processes with handleApiResponse, adds context, formats output, and handles errors.
    withUsageTracking('get-function', async (args) => {
      try {
        const response = await fetch(`${API_BASE_URL}/api/functions/${args.slug}`, {
          method: 'GET',
          headers: {
            'x-api-key': getApiKey(),
          },
        });
    
        const result = await handleApiResponse(response);
    
        return await addBackgroundContext({
          content: [
            {
              type: 'text',
              text: formatSuccessMessage(`Edge function '${args.slug}' details`, result),
            },
          ],
        });
      } catch (error) {
        const errMsg = error instanceof Error ? error.message : 'Unknown error occurred';
        return {
          content: [
            {
              type: 'text',
              text: `Error getting function: ${errMsg}`,
            },
          ],
          isError: true,
        };
      }
    })
  • Zod input schema for 'get-function' tool requiring a 'slug' parameter.
    {
      slug: z.string().describe('The slug identifier of the function'),
    },
  • Helper wrapper 'withUsageTracking' used by 'get-function' handler to track tool usage success/failure.
    function withUsageTracking<T extends unknown[], R>(
      toolName: string,
      handler: (...args: T) => Promise<R>
    ): (...args: T) => Promise<R> {
      return async (...args: T): Promise<R> => {
        try {
          const result = await handler(...args);
          await trackToolUsage(toolName, true);
          return result;
        } catch (error) {
          await trackToolUsage(toolName, false);
          throw error;
        }
      };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states it 'Get details' including code, which implies a read-only operation, but doesn't cover critical aspects like authentication needs, rate limits, error handling, or what 'details' beyond code are included. This leaves significant gaps for a tool that retrieves potentially sensitive function code.

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 unnecessary words. It's front-loaded with the core action and resource, making it easy to parse quickly.

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 complexity of retrieving function details (including code) and the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'details' encompass beyond code, potential security implications, or response format, leaving the agent with insufficient context for proper usage.

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 description coverage is 100%, with the single parameter 'slug' well-documented in the schema. The description adds no additional parameter information beyond what the schema provides, such as format examples or constraints. Baseline 3 is appropriate since the schema handles parameter documentation adequately.

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 'Get' and resource 'details of a specific edge function including its code', making the purpose understandable. It distinguishes from siblings like 'list-buckets' or 'create-function' by focusing on retrieval of a single function's details, though it doesn't explicitly differentiate from similar tools like 'get-table-schema'.

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 doesn't mention prerequisites (e.g., needing a function slug), when not to use it (e.g., for listing functions), or direct alternatives among siblings like 'get-backend-metadata' or 'get-container-logs'.

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/InsForge/insforge-mcp'

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