Skip to main content
Glama
martin-1103
by martin-1103

get_project_context

Retrieve project environments and folder structures to understand API development context and available resources for testing workflows.

Instructions

Get project context including environments and folders. Validates MCP token and returns enriched project data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'get_project_context' tool. It initializes authentication dependencies, detects the project configuration, fetches the project context from the BackendClient, processes the response (handling different formats), and returns a formatted text response with project details, environments, and folders.
    [getProjectContextTool.name]: async (args: Record<string, any>) => {
      try {
        const { configManager, backendClient } = await getAuthDependencies();
    
        // Get project ID from config
        const config = await configManager.detectProjectConfig();
        console.error('[AUTH] Config loaded:', JSON.stringify(config, null, 2));
        if (!config) {
          throw new Error('No configuration found - make sure gassapi.json exists');
        }
        const projectId = config?.project?.id;
        if (!projectId) {
          throw new Error('Project ID not found in gassapi.json configuration');
        }
    
        const result = await backendClient.getProjectContext(projectId);
    
        if (result.success && result.data) {
          // Handle different response formats from backend
          let project: any, environments: any[], folders: any[], user: any;
    
          if (result.data.project) {
            // Full context response (what we want from project_context endpoint)
            project = result.data.project;
            environments = result.data.environments || [];
            folders = result.data.folders || [];
            user = result.data.user;
          } else {
            // Basic project response (what we get from project endpoint)
            project = result.data;
            environments = [];
            folders = [];
            user = {
              id: project.owner_id,
              token_type: 'mcp',
              authenticated: true
            };
          }
    
          let contextText = `šŸ“ Project Context Retrieved\n\n`;
          contextText += `šŸ” Authentication: ${user?.token_type === 'mcp' ? 'āœ… MCP Token Validated' : 'āœ… JWT Authenticated'}\n\n`;
    
          contextText += `šŸ“‹ Project Details:\n`;
          contextText += `- Name: ${project.name}\n`;
          contextText += `- ID: ${project.id}\n`;
          if (project.description) {
            contextText += `- Description: ${project.description}\n`;
          }
    
          if (environments && environments.length > 0) {
            contextText += `\nšŸŒ Environments (${environments.length}):\n`;
            environments.forEach((env: any) => {
              contextText += `- ${env.name} (${env.id})${env.is_default ? ' [Default]' : ''}\n`;
            });
          }
    
          if (folders && folders.length > 0) {
            contextText += `\nšŸ“š Folders (${folders.length}):\n`;
            folders.forEach((folder: any) => {
              contextText += `- ${folder.name} (${folder.id})`;
              if (folder.endpoint_count) {
                contextText += ` - ${folder.endpoint_count} endpoints`;
              }
              contextText += '\n';
            });
          }
    
          return {
            content: [
              {
                type: 'text',
                text: contextText
              }
            ]
          };
        } else {
          return {
            content: [
              {
                type: 'text',
                text: `āŒ Failed to get project context: ${result.error || 'Unknown error'}`
              }
            ],
            isError: true
          };
        }
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `āŒ Project context error: ${error instanceof Error ? error.message : 'Unknown error'}`
            }
          ],
          isError: true
        };
      }
    }
  • Tool definition including name, description, and input schema (empty object, no parameters required).
    export const getProjectContextTool: McpTool = {
      name: 'get_project_context',
      description: 'Get project context including environments and folders. Validates MCP token and returns enriched project data.',
      inputSchema: {
        type: 'object',
        properties: {}
      }
    };
  • Exports the get_project_context tool as part of AUTH_TOOLS array for inclusion in the main tool registry.
    export const AUTH_TOOLS: McpTool[] = [
      getProjectContextTool
    ];
  • Registers the get_project_context tool (via ...AUTH_TOOLS) in the complete ALL_TOOLS list used by the MCP server.
    export const ALL_TOOLS: McpTool[] = [
      ...CORE_TOOLS,
      ...AUTH_TOOLS,
      ...environmentTools,
      ...folderTools,
      ...ENDPOINT_TOOLS,
      ...testingTools,
      ...flowTools
    ];
  • Registers the handler for get_project_context (via ...createAuthToolHandlers()) in the complete tool handlers map.
    export function createAllToolHandlers(): Record<string, (args: any) => Promise<McpToolResponse>> {
      return {
        ...createCoreToolHandlers(),
        ...createAuthToolHandlers(),
        ...createEnvironmentToolHandlers(),
        ...createFolderToolHandlers(),
        ...createEndpointToolHandlers(),
        ...createTestingToolHandlers(),
        ...createFlowToolHandlers()
      };
    }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It mentions token validation and returns enriched data, which adds useful context beyond basic functionality. However, it lacks details on error handling, rate limits, or what 'enriched' entails, leaving gaps in behavioral understanding.

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, efficient sentence that front-loads the core purpose. It avoids unnecessary words, though it could be slightly more structured by separating the token validation aspect into a second sentence for clarity.

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

Completeness3/5

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

Given no annotations, no output schema, and 0 parameters, the description is minimally adequate. It covers the purpose and some behavioral aspects but lacks details on output format or error cases, which could be important for a tool that validates tokens and returns data.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description adds value by implying token validation as part of the process, which isn't captured in the schema, justifying a score above the baseline of 3.

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 ('Get') and the resource ('project context including environments and folders'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_environment_details' or 'get_folder_details', which might retrieve similar data but for specific resources rather than the broader project context.

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. With many sibling tools like 'get_environment_details' and 'get_folder_details' that might retrieve overlapping or more specific data, there's no indication of whether this tool is for a high-level overview or when other tools are preferable.

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/martin-1103/mcp2'

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