Skip to main content
Glama

pilot_set_cookie

Set cookies on web pages to manage sessions, store user preferences, or test authentication flows during browser automation.

Instructions

Set a cookie on the current page domain.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesCookie name
valueYesCookie value

Implementation Reference

  • The handler for 'pilot_set_cookie' is registered and implemented within 'registerSettingsTools' in 'src/tools/settings.ts'. It uses the 'BrowserManager' to add a cookie to the current page's domain.
    server.tool(
      'pilot_set_cookie',
      'Set a cookie on the current page domain.',
      {
        name: z.string().describe('Cookie name'),
        value: z.string().describe('Cookie value'),
      },
      async ({ name, value }) => {
        await bm.ensureBrowser();
        try {
          const page = bm.getPage();
          const url = new URL(page.url());
          await page.context().addCookies([{
            name,
            value,
            domain: url.hostname,
            path: '/',
          }]);
          return { content: [{ type: 'text' as const, text: `Cookie set: ${name}=****` }] };
        } catch (err) {
          return { content: [{ type: 'text' as const, text: wrapError(err) }], isError: true };
        }
      }
    );

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/TacosyHorchata/Pilot'

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