Skip to main content
Glama
Luko248

@depthark/css-first

check_css_browser_support

Check browser compatibility for CSS properties using MDN data to ensure cross-browser functionality and avoid implementation issues.

Instructions

Checks browser support for specific CSS properties using MDN data and provides detailed compatibility information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
css_propertyYesCSS property name to check browser support for
include_experimentalNoInclude experimental/draft features in results

Implementation Reference

  • Main execution handler for the check_css_browser_support tool. Fetches MDN browser support data, generates recommendation, and returns JSON-formatted response with safety assessment.
    async (args: { css_property: string; include_experimental?: boolean }) => {
      try {
        const { css_property, include_experimental = false } = args;
    
        const supportInfo: BrowserSupportInfo = await fetchBrowserSupportFromMDN(
          css_property,
          include_experimental
        );
    
        const result = {
          property: css_property,
          browser_support: supportInfo,
          recommendation: generateBrowserSupportRecommendation(supportInfo),
          safe_to_use: supportInfo.overall_support >= 80,
        };
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(
                {
                  error: error instanceof Error ? error.message : "Unknown error",
                },
                null,
                2
              ),
            },
          ],
        };
      }
    }
  • Zod input schema defining parameters: css_property (string, required) and include_experimental (boolean, optional).
      css_property: z
        .string()
        .describe("CSS property name to check browser support for"),
      include_experimental: z
        .boolean()
        .optional()
        .describe("Include experimental/draft features in results"),
    },
  • src/index.ts:171-224 (registration)
    MCP server.tool registration call for 'check_css_browser_support' tool, including name, description, schema, and handler function.
    server.tool(
      "check_css_browser_support",
      "Checks browser support for specific CSS properties using MDN data and provides detailed compatibility information.",
      {
        css_property: z
          .string()
          .describe("CSS property name to check browser support for"),
        include_experimental: z
          .boolean()
          .optional()
          .describe("Include experimental/draft features in results"),
      },
      async (args: { css_property: string; include_experimental?: boolean }) => {
        try {
          const { css_property, include_experimental = false } = args;
    
          const supportInfo: BrowserSupportInfo = await fetchBrowserSupportFromMDN(
            css_property,
            include_experimental
          );
    
          const result = {
            property: css_property,
            browser_support: supportInfo,
            recommendation: generateBrowserSupportRecommendation(supportInfo),
            safe_to_use: supportInfo.overall_support >= 80,
          };
    
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify(result, null, 2),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify(
                  {
                    error: error instanceof Error ? error.message : "Unknown error",
                  },
                  null,
                  2
                ),
              },
            ],
          };
        }
      }
    );
  • Core helper function that fetches or simulates browser support data for a given CSS property from MDN sources, with caching and fallback logic.
    export async function fetchBrowserSupportFromMDN(
      cssProperty: string,
      includeExperimental: boolean = false
    ): Promise<BrowserSupportInfo> {
      try {
        const mdnData = await fetchMDNData(cssProperty);
    
        const supportInfo: BrowserSupportInfo = {
          overall_support:
            mdnData.browserSupport?.overall_support ||
            getBrowserSupportPercentage(cssProperty),
          browsers: mdnData.browserSupport?.browsers || {
            chrome: { version: "90+", support: "full" },
            firefox: { version: "88+", support: "full" },
            safari: { version: "14+", support: "full" },
            edge: { version: "90+", support: "full" },
          },
          experimental_features: includeExperimental
            ? getExperimentalFeatures(cssProperty)
            : [],
        };
    
        return supportInfo;
      } catch {
        // Fallback to static data
        return {
          overall_support: getBrowserSupportPercentage(cssProperty),
          browsers: {
            chrome: { version: "90+", support: "full" },
            firefox: { version: "88+", support: "full" },
            safari: { version: "14+", support: "full" },
            edge: { version: "90+", support: "full" },
          },
          experimental_features: includeExperimental
            ? getExperimentalFeatures(cssProperty)
            : [],
        };
      }
    }
  • Helper function that generates human-readable recommendation text based on browser support percentage.
    export function generateBrowserSupportRecommendation(supportInfo: any): string {
      const { overall_support } = supportInfo;
      
      if (overall_support >= 95) {
        return 'Excellent browser support. Safe to use in production without fallbacks.';
      } else if (overall_support >= 85) {
        return 'Good browser support. Consider fallbacks for legacy browsers if needed.';
      } else if (overall_support >= 70) {
        return 'Moderate browser support. Provide fallbacks for older browsers.';
      } else {
        return 'Limited browser support. Consider alternative approaches or polyfills.';
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but only states what the tool does at a high level. It doesn't disclose behavioral traits like response format, error handling, rate limits, authentication needs, or whether it's a read-only operation. The mention of 'detailed compatibility information' is vague.

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 front-loads the core purpose. Every word earns its place by specifying the action, resource, data source, and output type without redundancy or unnecessary elaboration.

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 no annotations and no output schema, the description is incomplete for a tool that returns 'detailed compatibility information.' It doesn't explain what the output looks like (e.g., browser versions, support levels), potential limitations, or how to interpret results. This leaves significant gaps for an AI agent.

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%, so the schema already documents both parameters thoroughly. The description adds no additional meaning beyond what's in the schema (e.g., no examples of CSS property formats, no clarification on what 'experimental/draft features' entail). Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Checks') and resource ('browser support for specific CSS properties'), specifies the data source ('using MDN data'), and distinguishes from siblings by focusing on compatibility information rather than usage confirmation, property details, or solution suggestions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when browser compatibility information is needed, but provides no explicit guidance on when to use this tool versus the sibling tools (confirm_css_property_usage, get_css_property_details, suggest_css_solution). No exclusions or alternatives are mentioned.

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/Luko248/css-first'

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