Skip to main content
Glama
moneyforward-i

Admina MCP Server

get_devices

Retrieve a list of devices for your organization with advanced search and filtering, including text search, field-specific filters, pagination, and sorting.

Instructions

Get a list of devices for an organization using advanced search and filtering.

Key Features

  • Combine query parameters (pagination, sorting) with body parameters (filtering)

  • Support for text search, field-specific filters, and complex queries

  • Pagination with cursor-based navigation

Example Usage

Find first 5 devices for user with email "someone@gmail.com":

  • Query: limit=5

  • Body: {"searchTerm": "someone@gmail.com", "searchFields": ["people.primaryEmail"]}

Pro Tips

  • 1: Always make sure understand the definition of the fields (preset and custom fields) before using them.

  • 2: If user search devices by category: pc, phone or other, please use body.type to filter devices by category.

  • 3: Always to understand what are current sub types of the devices. If the user search information relate to sub types, Please use body.filters.["preset.subtype"] to filter devices by sub types.

  • 4: We don't really need to use searchFields parameter to the search results in all fields, only use it when the user search information relate to specific fields.

  • 5: If user want to filter devices by status, please use body.filters.["preset.status"].eq to filter devices by status.

  • 5.1: Unassigned devices status should be "in_stock" or "decommissioned".

  • 6: If user want to filter devices by preset fields or custom fields, please check the field.kind first, we only support date, number, dropdown kind of fields.

  • 6.1: If the field.kind is date, please use body.filters.["preset.field_name"].minDate or body.filters.["custom.attributeCode"].minDate and body.filters.["preset.field_name"].maxDate or body.filters.["custom.attributeCode"].maxDate to filter devices by date range.

  • 6.2: If the field.kind is number, please use body.filters.["preset.field_name"].minNumber or body.filters.["custom.attributeCode"].minNumber and body.filters.["preset.field_name"].maxNumber or body.filters.["custom.attributeCode"].maxNumber to filter devices by number range.

  • 6.3: If the preset field field.kind is dropdown, please use body.filters.["preset.field_name"].eq or body.filters.["custom.attributeCode"].eq to filter devices by dropdown value.

  • 7: Combine multiple filters examples: {"preset.status":{"eq":"active"},"preset.subtype":{"eq":"desktop_pc"},"custom.custom_xxx":{"eq":"1"},"custom.dt_13":{"minDate":"2025-12-23","maxDate":"2025-12-25"},"custom.drp_4":{"eq":"1"}}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of items to return per page
cursorNoBase64-encoded cursor for pagination
sortByNoSort by field. Format: `<preset | custom>.<unique field name>` or `people.displayName`
sortOrderNoSort order for the results
expandsNoExpand other datasets when fetching devices
peopleIdNoFilter devices by the people ID assigned to them
typeNoFilter devices by device type
employeeStatusNoFilter devices by the employment status of the assigned person
searchTermNoSearch term to filter devices
searchFieldsNoArray of field names to search within when using searchTerm. Supports memo, people fields, preset fields, and custom fields
filtersNoAdvanced filters. Keys look like `preset.<unique field name>`. There are certain extra virtual fields, such as `$age`

Implementation Reference

  • The main handler function that executes the get_devices tool logic. It takes DeviceFilters, constructs query parameters and request body, then calls client.makePostApiCall('/devices/search', queryParams, body) to fetch devices from the API.
    export async function getDevices(filters: DeviceFilters) {
      const client = getClient();
    
      // Separate query params from request body
      const queryParams = new URLSearchParams();
      if (filters.limit !== undefined) queryParams.append("limit", filters.limit.toString());
      if (filters.cursor) queryParams.append("cursor", filters.cursor);
      if (filters.sortBy) queryParams.append("sortBy", filters.sortBy);
      if (filters.sortOrder) queryParams.append("sortOrder", filters.sortOrder);
      if (filters.expands) {
        for (const expand of filters.expands) {
          queryParams.append("expands", expand);
        }
      }
    
      // Build request body
      const body: Record<string, unknown> = {};
      if (filters.peopleId !== undefined) body.peopleId = filters.peopleId;
      if (filters.type) body.type = filters.type;
      if (filters.employeeStatus) body.employeeStatus = filters.employeeStatus;
      if (filters.searchTerm) body.searchTerm = filters.searchTerm;
      if (filters.searchFields) body.searchFields = filters.searchFields;
      if (filters.filters) body.filters = filters.filters;
    
      return client.makePostApiCall("/devices/search", queryParams, body);
    }
  • The DeviceFiltersSchema (Zod schema) that defines all input parameters for the get_devices tool, including pagination (limit, cursor), sorting (sortBy, sortOrder), expands, and filtering (peopleId, type, employeeStatus, searchTerm, searchFields, advanced filters).
    export const DeviceFiltersSchema = z.object({
      // Query parameters
      limit: z.number().max(200).optional().describe("Maximum number of items to return per page"),
      cursor: z.string().optional().describe("Base64-encoded cursor for pagination"),
      sortBy: z
        .string()
        .optional()
        .describe("Sort by field. Format: `<preset | custom>.<unique field name>` or `people.displayName`"),
      sortOrder: z.enum(["DESC", "ASC"]).optional().describe("Sort order for the results"),
      expands: z
        .array(z.enum(["relatedIdentity", "customFieldsMetadata"]))
        .optional()
        .describe("Expand other datasets when fetching devices"),
    
      // Request body parameters
      peopleId: z.number().optional().describe("Filter devices by the people ID assigned to them"),
      type: z.enum(["pc", "phone", "other"]).optional().describe("Filter devices by device type"),
      employeeStatus: z
        .enum(["active", "on_leave", "draft", "preactive", "retired", "untracked"])
        .optional()
        .describe("Filter devices by the employment status of the assigned person"),
      searchTerm: z.string().optional().describe("Search term to filter devices"),
      searchFields: z
        .array(z.string())
        .optional()
        .describe(
          "Array of field names to search within when using searchTerm. Supports memo, people fields, preset fields, and custom fields",
        ),
      filters: z
        .record(z.string(), DeviceFilterOptionsSchema)
        .optional()
        .describe(
          "Advanced filters. Keys look like `preset.<unique field name>`. There are certain extra virtual fields, such as `$age`",
        ),
    });
  • The DeviceFilterOptionsSchema defines the structure for advanced filter options, supporting minDate, maxDate, minNumber, maxNumber, and eq for filtering by date, number, or dropdown field kinds.
    const DeviceFilterOptionsSchema = z.object({
      minDate: z.string().optional().describe("Only supported by fields with `date` kind"),
      maxDate: z.string().optional().describe("Only supported by fields with `date` kind"),
      minNumber: z
        .number()
        .optional()
        .describe("Only supported by fields with `number` kind and few special fields such as `$age`"),
      maxNumber: z
        .number()
        .optional()
        .describe("Only supported by fields with `number` kind and few special fields such as `$age`"),
      eq: z.string().optional().describe("Only supported by fields with `dropdown` kind"),
    });
  • src/index.ts:291-291 (registration)
    The tool is registered in the ListToolsRequestSchema handler with name 'get_devices', description with usage examples, and inputSchema derived from DeviceFiltersSchema.
    });
  • src/index.ts:299-299 (registration)
    The tool handler is mapped in the toolHandlers record under key 'get_devices', which calls getDevices(DeviceFiltersSchema.parse(input)) to parse and execute the tool.
    get_devices: async (input) => getDevices(DeviceFiltersSchema.parse(input)),
Behavior4/5

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

No annotations provided, so the description carries full burden. It covers pagination with cursor, sorting, and complex filtering behaviors. It does not explicitly state it's a read-only operation, but the name and context imply querying.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is quite long with many pro tips, some redundant. While well-structured, it could be more concise without losing essential guidance.

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?

Given the complexity of 11 parameters and nested objects, the description is thorough with examples and rules for filtering. It does not describe the return format, but the name implies a list of devices.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, but the description adds significant value beyond the schema, such as explaining how to combine filters for different field kinds (date, number, dropdown) and providing concrete examples.

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 'Get a list of devices for an organization using advanced search and filtering.' This is a specific verb+resource, distinguishing it from siblings like create_device or update_device.

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

Usage Guidelines4/5

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

The description provides an example of combining parameters and extensive pro tips on when to use specific filters. However, it does not explicitly state when not to use this tool or mention alternatives.

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/moneyforward-i/admina-mcp-server'

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