Skip to main content
Glama

FindLabels

Filter and retrieve record labels from RushDB with customizable conditions, sorting, and pagination options for precise data queries.

Instructions

Find / filter record labels (supports where, limit, skip, orderBy). Superset of GetLabels.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
whereNoFilter conditions for labels (e.g., by activity flags, counts)
limitNoMaximum number of labels to return
skipNoNumber of labels to skip
orderByNoSorting configuration: key = field, value = asc|desc

Implementation Reference

  • The core handler function that executes the tool logic: queries the labels in the database using provided where, limit, skip, orderBy filters and normalizes the response to [{name, count}] array.
    export async function FindLabels( params: { where?: Record<string, any> limit?: number skip?: number orderBy?: Record<string, 'asc' | 'desc'> } = {} ) { const { where, limit, skip, orderBy } = params const searchQuery: Record<string, any> = {} if (where) searchQuery.where = where if (typeof limit === 'number') searchQuery.limit = limit if (typeof skip === 'number') searchQuery.skip = skip if (orderBy && Object.keys(orderBy).length > 0) searchQuery.orderBy = orderBy const response = await db.labels.find(searchQuery) // Existing labels.find returns an object mapping label->count when empty query supplied. // When filters applied, SDK still returns .data as mapping; normalize to array. if (response?.success && response.data) { return Object.entries(response.data).map(([name, count]) => ({ name, count })) } return [] }
  • JSON Schema definition for the input parameters of the FindLabels tool.
    inputSchema: { type: 'object', properties: { where: { type: 'object', description: 'Filter conditions for labels (e.g., by activity flags, counts)' }, limit: { type: 'number', description: 'Maximum number of labels to return' }, skip: { type: 'number', description: 'Number of labels to skip' }, orderBy: { type: 'object', description: 'Sorting configuration: key = field, value = asc|desc', additionalProperties: { type: 'string', enum: ['asc', 'desc'] } } }, required: [] }
  • tools.ts:55-75 (registration)
    Registration of the FindLabels tool in the exported tools array used by MCP for listing available tools.
    { name: 'FindLabels', description: 'Find / filter record labels (supports where, limit, skip, orderBy). Superset of GetLabels.', inputSchema: { type: 'object', properties: { where: { type: 'object', description: 'Filter conditions for labels (e.g., by activity flags, counts)' }, limit: { type: 'number', description: 'Maximum number of labels to return' }, skip: { type: 'number', description: 'Number of labels to skip' }, orderBy: { type: 'object', description: 'Sorting configuration: key = field, value = asc|desc', additionalProperties: { type: 'string', enum: ['asc', 'desc'] } } }, required: [] } },
  • index.ts:118-135 (registration)
    MCP CallToolRequest handler switch case that dispatches to the FindLabels implementation and formats the textual response.
    case 'FindLabels': const foundLabels = await FindLabels({ where: args.where as Record<string, any> | undefined, limit: args.limit as number | undefined, skip: args.skip as number | undefined, orderBy: args.orderBy as Record<string, 'asc' | 'desc'> | undefined }) return { content: [ { type: 'text', text: foundLabels.length > 0 ? foundLabels.map((l: any) => `${l.name}: ${l.count} records`).join('\n') : 'No labels found' } ] }

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/1pxone/RushDB'

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