Skip to main content
Glama
ZLeventer

hubspot-mcp

hs_pipeline_summary

Aggregate deal counts and total amounts by pipeline stage to get a quick funnel snapshot for a specified pipeline.

Instructions

Deal counts and total amounts aggregated by pipeline stage — a quick funnel snapshot for a given pipeline.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pipelineIdYesPipeline ID (from list_pipelines)

Implementation Reference

  • The pipelineSummary function fetches pipeline stages and deals, then aggregates deal counts and total amounts by stage. It queries stages via GET /crm/v3/pipelines/deals/{pipelineId}/stages and searches deals via POST /crm/v3/objects/deals/search filtered by pipeline ID, then groups deal count and total amount by stage, sorted by displayOrder.
    export async function pipelineSummary(args: z.infer<typeof PipelineSummarySchema>) {
      const [stages, deals] = await Promise.all([
        hubspot<{ results: Array<{ id: string; label: string; displayOrder: number; metadata: { probability: string } }> }>(
          `/crm/v3/pipelines/deals/${args.pipelineId}/stages`,
        ),
        hubspot<{ results: Array<{ properties: Record<string, string> }> }>(
          "/crm/v3/objects/deals/search", "POST", {
            filterGroups: [{ filters: [{ propertyName: "pipeline", operator: "EQ", value: args.pipelineId }] }],
            properties: ["dealstage", "amount", "hs_is_closed"],
            limit: 200,
          },
        ),
      ]);
    
      const byStage: Record<string, { label: string; count: number; totalAmount: number }> = {};
      for (const stage of stages.results) {
        byStage[stage.id] = { label: stage.label, count: 0, totalAmount: 0 };
      }
      for (const deal of deals.results) {
        const { dealstage, amount } = deal.properties;
        if (byStage[dealstage]) {
          byStage[dealstage].count++;
          byStage[dealstage].totalAmount += parseFloat(amount ?? "0") || 0;
        }
      }
    
      return {
        pipelineId: args.pipelineId,
        stages: stages.results
          .sort((a, b) => a.displayOrder - b.displayOrder)
          .map((s) => ({
            id: s.id,
            probability: s.metadata?.probability,
            ...byStage[s.id],
            label: s.label,
          })),
      };
    }
  • PipelineSummarySchema defines a single required input: pipelineId (string) — the pipeline ID from list_pipelines.
    export const PipelineSummarySchema = z.object({
      pipelineId: z.string().describe("Pipeline ID (from list_pipelines)"),
    });
  • src/index.ts:186-191 (registration)
    Registration of the 'hs_pipeline_summary' tool on the MCP server with description, schema, and handler invocation.
    server.tool(
      "hs_pipeline_summary",
      "Deal counts and total amounts aggregated by pipeline stage — a quick funnel snapshot for a given pipeline.",
      PipelineSummarySchema.shape,
      async (args) => { try { return ok(await pipelineSummary(args)); } catch (e) { return err(e); } },
    );
  • A companion helper function listPipelines which fetches all pipelines (deals or tickets) to get pipeline IDs used by pipelineSummary.
    export async function listPipelines(args: z.infer<typeof ListPipelinesSchema>) {
      const type = args.objectType ?? "deals";
      return hubspot(`/crm/v3/pipelines/${type}`);
    }
Behavior2/5

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

No annotations provided, so description carries full burden. Lacks detail on e.g., whether all stages are returned, read-only nature, or any limits. 'Aggregated by pipeline stage' is present but not expanded.

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?

Single sentence, front-loaded, no redundant words. Efficient and to the point.

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?

Adequate for a simple 1-param tool with no output schema, but could benefit from describing the output shape (e.g., per-stage breakdown, totals).

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% with pipelineId having a clear description. The tool description adds 'for a given pipeline' which is consistent but not new information.

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?

Clearly states 'deal counts and total amounts aggregated by pipeline stage', a specific verb+resource combination. Distinguishes from siblings like hs_deals_by_stage by focusing on aggregated metrics.

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 explicit guidance on when to use vs alternatives. Implies a 'quick funnel snapshot' but doesn't contrast with hs_deals_by_stage or other similar tools.

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/ZLeventer/hubspot-mcp'

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