Skip to main content
Glama

get-context-info

Retrieve detailed information about a specific browser instance by providing its context ID, enabling inspection of browser state and configuration.

Instructions

Gets detailed information about a specific browser instance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contextIdYesID of the browser to inspect

Implementation Reference

  • Handler function that retrieves detailed information about a specific browser context. Fetches the browser object, current URL, activity status, and shared browser details, then returns formatted JSON response.
    async ({ contextId }) => {
      try {
        const browser = contextManager.getContext(contextId);
    
        if (!browser) {
          return {
            content: [
              {
                type: 'text',
                text: `Browser not found: ${contextId}`
              }
            ],
            isError: true
          };
        }
    
        // Get shared browser info for CDP endpoint
        const sharedBrowserInfo = contextManager.getSharedBrowserInfo();
        
        const browserInfo = {
          id: browser.id,
          type: browser.type,
          displayName: browser.displayName,
          metadata: browser.metadata,
          createdAt: browser.createdAt,
          lastUsedAt: browser.lastUsedAt,
          isActive: contextManager.hasContext(contextId),
          currentUrl: browser.page.url(),
          sharedBrowser: sharedBrowserInfo ? {
            type: sharedBrowserInfo.type,
            createdAt: sharedBrowserInfo.createdAt,
            contextCount: sharedBrowserInfo.contextCount,
            cdpEndpoint: sharedBrowserInfo.cdpEndpoint
          } : null
        };
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(browserInfo, null, 2)
            }
          ]
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        Logger.error(`Failed to get browser info for ${contextId}:`, error);
        return {
          content: [
            {
              type: 'text',
              text: `Failed to get browser info: ${errorMessage}`
            }
          ],
          isError: true
        };
      }
    }
  • Input schema for the 'get-context-info' tool, requiring a contextId string parameter.
    {
      contextId: z.string().describe('ID of the browser to inspect')
    },
  • Registration of the 'get-context-info' tool using server.tool(), including name, description, input schema, and handler function.
    server.tool(
      'get-context-info',
      'Gets detailed information about a specific browser instance',
      {
        contextId: z.string().describe('ID of the browser to inspect')
      },
      async ({ contextId }) => {
        try {
          const browser = contextManager.getContext(contextId);
    
          if (!browser) {
            return {
              content: [
                {
                  type: 'text',
                  text: `Browser not found: ${contextId}`
                }
              ],
              isError: true
            };
          }
    
          // Get shared browser info for CDP endpoint
          const sharedBrowserInfo = contextManager.getSharedBrowserInfo();
          
          const browserInfo = {
            id: browser.id,
            type: browser.type,
            displayName: browser.displayName,
            metadata: browser.metadata,
            createdAt: browser.createdAt,
            lastUsedAt: browser.lastUsedAt,
            isActive: contextManager.hasContext(contextId),
            currentUrl: browser.page.url(),
            sharedBrowser: sharedBrowserInfo ? {
              type: sharedBrowserInfo.type,
              createdAt: sharedBrowserInfo.createdAt,
              contextCount: sharedBrowserInfo.contextCount,
              cdpEndpoint: sharedBrowserInfo.cdpEndpoint
            } : null
          };
    
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(browserInfo, null, 2)
              }
            ]
          };
        } catch (error) {
          const errorMessage = error instanceof Error ? error.message : String(error);
          Logger.error(`Failed to get browser info for ${contextId}:`, error);
          return {
            content: [
              {
                type: 'text',
                text: `Failed to get browser info: ${errorMessage}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • src/index.ts:81-83 (registration)
    Invocation of registerBrowserManagerTools which registers the 'get-context-info' tool among others to the MCP server.
    // Register new context manager tools
    const contextManager = registerBrowserManagerTools(server);
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 states it 'Gets detailed information' but doesn't specify what 'detailed information' includes, whether it's read-only, has side effects, or requires specific permissions. This is a significant gap for a tool with zero annotation coverage.

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 is appropriately sized and front-loaded, with every word earning its place.

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 explain what 'detailed information' entails, the return format, or behavioral traits, making it inadequate for a tool that likely returns complex data about a browser instance.

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 schema description coverage is 100%, with the parameter 'contextId' clearly documented as 'ID of the browser to inspect'. The description adds no additional parameter details beyond what the schema provides, so 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 ('Gets') and resource ('detailed information about a specific browser instance'), making the purpose evident. However, it doesn't explicitly differentiate from sibling tools like 'get-context-stats' or 'list-browsers', which likely provide different types of browser information.

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?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites, exclusions, or compare it to siblings like 'get-context-stats' or 'list-browsers', leaving the agent to infer usage context.

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/ESnark/blowback'

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