Skip to main content
Glama

get_business_profile

Retrieve a complete business profile with services, hours, credentials, languages, contact channels, and a UTM-tagged booking URL using the business ID.

Instructions

Get full structured profile for a business by ID. Returns services, hours, credentials, languages, contact channels, and a UTM-tagged booking URL.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesBusiness ID returned by search_businesses.
agentNameNoOptional MCP client identifier (e.g. 'chatgpt', 'claude', 'gemini'). Used for UTM attribution.

Implementation Reference

  • The main handler function for the get_business_profile tool. It accepts an id and optional agentName, fetches the business profile from the database, UTM-tags the booking URL using tagBookingUrl (with campaign='profile'), and returns the full BusinessProfile object or an error.
    export async function getBusinessProfile(
      input: GetBusinessProfileInput
    ): Promise<BusinessProfile | { error: string }> {
      const profile = await getBusinessById(input.id);
      if (!profile) return { error: `No business found with id: ${input.id}` };
    
      // Strip raw booking URL → return UTM-tagged version.
      const tagged = profile.bookingUrl
        ? tagBookingUrl(profile.bookingUrl, {
            businessId: profile.id,
            agentName: input.agentName,
            campaign: "profile"
          })
        : undefined;
    
      return { ...profile, bookingUrl: tagged };
    }
  • Zod schema for get_business_profile input validation. Defines 'id' (required string) and 'agentName' (optional string for UTM attribution).
    export const getBusinessProfileSchema = z.object({
      id: z.string().describe("Business ID returned by search_businesses."),
      agentName: z
        .string()
        .optional()
        .describe(
          "Optional MCP client identifier (e.g. 'chatgpt', 'claude', 'gemini'). Used for UTM attribution."
        )
    });
  • src/server.ts:35-43 (registration)
    Registers the 'get_business_profile' tool on the McpServer using server.tool(), with a description, the schema shape, and an async callback that calls getBusinessProfile and returns the result as JSON string content.
    server.tool(
      "get_business_profile",
      "Get full structured profile for a business by ID. Returns services, hours, credentials, languages, contact channels, and a UTM-tagged booking URL.",
      getBusinessProfileSchema.shape,
      async (args) => {
        const profile = await getBusinessProfile(getBusinessProfileSchema.parse(args));
        return { content: [{ type: "text", text: JSON.stringify(profile, null, 2) }] };
      }
    );
  • The tagBookingUrl helper function used by getBusinessProfile to append UTM parameters (utm_source, utm_medium, utm_campaign, utm_term, utm_content) to a business's raw booking URL for analytics attribution.
    export function tagBookingUrl(rawUrl: string, ctx: UtmContext): string {
      if (!rawUrl) return rawUrl;
      let url: URL;
      try {
        url = new URL(rawUrl);
      } catch {
        // not a valid URL — return as-is rather than corrupting it
        return rawUrl;
      }
    
      url.searchParams.set("utm_source", SOURCE);
      url.searchParams.set("utm_medium", MEDIUM);
      if (ctx.campaign) url.searchParams.set("utm_campaign", ctx.campaign);
      if (ctx.agentName) url.searchParams.set("utm_term", ctx.agentName);
      url.searchParams.set("utm_content", ctx.businessId);
    
      return url.toString();
    }
  • The getBusinessById helper function used by getBusinessProfile to look up a business profile by its ID from the mock data or Supabase (Phase 2).
    export async function getBusinessById(id: string): Promise<BusinessProfile | null> {
      const all = await getAllBusinesses();
      return all.find((b) => b.id === id) ?? null;
    }
Behavior3/5

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

No annotations provided; description carries full burden. It describes returns but does not disclose safety (read-only assumed), authentication needs, rate limits, or potential errors. Adequate but not rich.

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?

Two concise sentences, front-loaded with purpose, no waste. Every word adds value.

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

Completeness4/5

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

No output schema, but description explains return values well. Parameter coverage is complete. Could mention output structure in more detail, but sufficient for typical use.

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 covers both params with descriptions (id from search_businesses, agentName for UTM). Description adds context about UTM-tagged URL but overall schema is sufficient. Baseline 3.

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?

Description clearly states it gets a full structured profile by ID, listing specific return fields (services, hours, etc.). Distinct from sibling tools like search_businesses or get_booking_options.

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?

Implied usage when you have a business ID and need a full profile, but no explicit when-to-use vs alternatives or when-not-to-use guidance. Sibling names suggest different purposes but not stated.

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/mutamiri-sudo/ailistmybusiness'

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