Skip to main content
Glama
deal-search.v1.ts3.51 kB
/** * Deal Search v1 Prompt * * Filter deals by owner, stage, value, close date window; output summary table. */ import { z } from 'zod'; import { PromptV1Definition, PromptMessage, PromptArgument } from './types.js'; import { UniversalReadArgs } from './types.js'; import { SEARCH_DEFAULTS, PAGINATION } from './constants.js'; /** * Argument schema for deal_search.v1 */ export const DealSearchArgs = z.object({ query: z .string() .min(3) .describe("Search query (e.g., 'deals > $50k closing this quarter')"), limit: z .number() .int() .min(1) .max(SEARCH_DEFAULTS.maxLimit) .optional() .default(SEARCH_DEFAULTS.limit) .describe( `Maximum results to return (default ${SEARCH_DEFAULTS.limit}, max ${SEARCH_DEFAULTS.maxLimit})` ), ...UniversalReadArgs, }); export type DealSearchArgsType = z.infer<typeof DealSearchArgs>; /** * Argument definitions for registration */ export const dealSearchArguments: PromptArgument[] = [ { name: 'query', description: "E.g., 'deals > $50k closing this quarter'", required: true, schema: z.string().min(3), }, { name: 'limit', description: `Default ${SEARCH_DEFAULTS.limit} (max ${SEARCH_DEFAULTS.maxLimit})`, required: false, schema: z.number().int().min(1).max(SEARCH_DEFAULTS.maxLimit), default: SEARCH_DEFAULTS.limit, }, { name: 'format', description: 'table | json | ids (default table)', required: false, schema: z.enum(['table', 'json', 'ids']), default: 'table', }, { name: 'fields_preset', description: 'sales_short | full (default sales_short)', required: false, schema: z.enum(['sales_short', 'full']), default: 'sales_short', }, { name: 'verbosity', description: 'brief | normal (default brief)', required: false, schema: z.enum(['brief', 'normal']), default: 'brief', }, ]; /** * Build prompt messages for deal search */ export function buildDealSearchMessages( args: Record<string, unknown> ): PromptMessage[] { const validated = DealSearchArgs.parse(args); const instructions = `Call \`records_query\` for object='deals' with filters derived from "${validated.query}". Output format=${validated.format}: - If table: Markdown table with columns: id, name, stage, value, close_date, owner, company (max ${validated.limit} rows) - If json: Structured array with same fields - If ids: Comma-separated list of deal IDs only Fields preset=${validated.fields_preset}: - sales_short: Only id, name, stage, value, close_date, owner, company (token-efficient) - full: Include all available fields Verbosity=${validated.verbosity}: - brief: No preamble, just the data - normal: Brief context + data Include a "Next actions" section with inline tools for advancing/updating deals. Append "${PAGINATION.moreAvailableText}" when results exceed ${validated.limit}.`; return [ { role: 'user', content: { type: 'text', text: instructions, }, }, ]; } /** * Complete prompt definition */ export const dealSearchPrompt: PromptV1Definition = { metadata: { name: 'deal_search.v1', title: 'Find deals', description: 'Filter deals by owner, stage, value, close date window. Returns summary table with key deal metrics.', category: 'search', version: 'v1', }, arguments: dealSearchArguments, buildMessages: buildDealSearchMessages, tokenBudget: 500, // Per spec }; export default dealSearchPrompt;

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/kesslerio/attio-mcp-server'

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