Skip to main content
Glama
moneyforward-i

Admina MCP Server

create_device_custom_field

Define a new custom field for organization devices by specifying a name, unique code, and field type. Optionally configure dropdown options for dropdown-type fields.

Instructions

Create a new custom field for organization devices. Defines a new field that can be used across all devices in the organization.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
attributeNameYesDisplay label for the custom field (REQUIRED)
attributeCodeYesUnique identifier for the custom field. Must contain only lowercase letters, numbers, and underscores (REQUIRED)
kindYesThe type of the custom field (REQUIRED)
configurationNoDropdown configuration with values. Only required for 'dropdown' kind fields.

Implementation Reference

  • The handler function 'createDeviceCustomField' that executes the tool logic. Constructs a body with attributeName, attributeCode, kind, and optionally configuration, then POSTs it to /fields/custom.
    export async function createDeviceCustomField(params: CreateDeviceCustomFieldParams) {
      const client = getClient();
    
      const body: Record<string, unknown> = {
        attributeName: params.attributeName,
        attributeCode: params.attributeCode,
        kind: params.kind,
      };
    
      if (params.configuration !== undefined) body.configuration = params.configuration;
    
      return client.makePostApiCall("/fields/custom", new URLSearchParams(), body);
    }
  • The Zod schema 'CreateDeviceCustomFieldSchema' defining input validation for the tool, including required attributeName, attributeCode, kind (text/number/date/dropdown), and optional dropdown configuration.
    export const CreateDeviceCustomFieldSchema = z.object({
      attributeName: z.string().describe("Display label for the custom field (REQUIRED)"),
      attributeCode: z
        .string()
        .describe(
          "Unique identifier for the custom field. Must contain only lowercase letters, numbers, and underscores (REQUIRED)",
        ),
      kind: z.enum(["text", "number", "date", "dropdown"]).describe("The type of the custom field (REQUIRED)"),
      configuration: DropdownConfigurationSchema.optional().describe(
        "Dropdown configuration with values. Only required for 'dropdown' kind fields.",
      ),
    });
  • src/index.ts:143-147 (registration)
    Tool registered as 'create_device_custom_field' in the ListToolsRequestSchema handler, with description and inputSchema.
      name: "create_device_custom_field",
      description:
        "Create a new custom field for organization devices. Defines a new field that can be used across all devices in the organization.",
      inputSchema: zodToJsonSchema(CreateDeviceCustomFieldSchema),
    },
  • src/index.ts:304-304 (registration)
    Tool handler mapping in the toolHandlers record, linking 'create_device_custom_field' to the createDeviceCustomField function with schema parsing.
    create_device_custom_field: async (input) => createDeviceCustomField(CreateDeviceCustomFieldSchema.parse(input)),
  • The AdminaApiClient class (including getClient factory) that provides the makePostApiCall method used by the handler to POST to /fields/custom.
    export class AdminaApiClient {
      private readonly apiKey: string;
      private readonly organizationId: string;
      private readonly ADMINA_API_BASE = "https://api.itmc.i.moneyforward.com/api/v1";
    
      constructor(apiKey: string, organizationId: string) {
        this.apiKey = apiKey;
        this.organizationId = organizationId;
      }
    
      // Generic method to make GET API calls
      public async makeApiCall<T>(
        endpoint: string,
        queryParams: URLSearchParams,
        config: AxiosRequestConfig = {},
      ): Promise<T> {
        try {
          const url = `${this.ADMINA_API_BASE}/organizations/${this.organizationId}${endpoint}?${queryParams.toString()}`;
    
          const response = await axios.get(url, {
            headers: {
              Authorization: `Bearer ${this.apiKey}`,
              "Content-Type": "application/json",
              ...MCP_USAGE_TRACKING_HEADERS,
            },
            ...config,
          });
    
          return response.data as T;
        } catch (error: unknown) {
          if (error instanceof AxiosError) {
            throw createAdminaError(error.status ?? 500, error.response?.data);
          }
          throw createAdminaError(500, { errorId: "non_axios_error" });
        }
      }
    
      // Generic method to make POST API calls
      public async makePostApiCall<T>(
        endpoint: string,
        queryParams: URLSearchParams,
        body: Record<string, unknown> = {},
        config: AxiosRequestConfig = {},
      ): Promise<T> {
        try {
          const queryString = queryParams.toString();
          const querySuffix = queryString ? `?${queryString}` : "";
          const url = `${this.ADMINA_API_BASE}/organizations/${this.organizationId}${endpoint}${querySuffix}`;
    
          const response = await axios.post(url, body, {
            headers: {
              Authorization: `Bearer ${this.apiKey}`,
              "Content-Type": "application/json",
              ...MCP_USAGE_TRACKING_HEADERS,
            },
            ...config,
          });
    
          return response.data as T;
        } catch (error: unknown) {
          if (error instanceof AxiosError) {
            throw createAdminaError(error.status ?? 500, error.response?.data);
          }
          throw createAdminaError(500, { errorId: "non_axios_error" });
        }
      }
    
      // Generic method to make PATCH API calls
      public async makePatchApiCall<T>(
        endpoint: string,
        body: Record<string, unknown> = {},
        config: AxiosRequestConfig = {},
      ): Promise<T> {
        try {
          const url = `${this.ADMINA_API_BASE}/organizations/${this.organizationId}${endpoint}`;
    
          const response = await axios.patch(url, body, {
            headers: {
              Authorization: `Bearer ${this.apiKey}`,
              "Content-Type": "application/json",
              ...MCP_USAGE_TRACKING_HEADERS,
            },
            ...config,
          });
    
          return response.data as T;
        } catch (error: unknown) {
          if (error instanceof AxiosError) {
            throw createAdminaError(error.status ?? 500, error.response?.data);
          }
          throw createAdminaError(500, { errorId: "non_axios_error" });
        }
      }
    
      // Generic method to make PUT API calls
      public async makePutApiCall<T>(
        endpoint: string,
        body: Record<string, unknown> = {},
        config: AxiosRequestConfig = {},
      ): Promise<T> {
        try {
          const url = `${this.ADMINA_API_BASE}/organizations/${this.organizationId}${endpoint}`;
    
          const response = await axios.put(url, body, {
            headers: {
              Authorization: `Bearer ${this.apiKey}`,
              "Content-Type": "application/json",
              ...MCP_USAGE_TRACKING_HEADERS,
            },
            ...config,
          });
    
          return response.data as T;
        } catch (error: unknown) {
          if (error instanceof AxiosError) {
            throw createAdminaError(error.status ?? 500, error.response?.data);
          }
          throw createAdminaError(500, { errorId: "non_axios_error" });
        }
      }
    
      // Generic method to make DELETE API calls
      public async makeDeleteApiCall<T>(endpoint: string, config: AxiosRequestConfig = {}): Promise<T> {
        try {
          const url = `${this.ADMINA_API_BASE}/organizations/${this.organizationId}${endpoint}`;
    
          const response = await axios.delete(url, {
            headers: {
              Authorization: `Bearer ${this.apiKey}`,
              "Content-Type": "application/json",
              ...MCP_USAGE_TRACKING_HEADERS,
            },
            ...config,
          });
    
          return response.data as T;
        } catch (error: unknown) {
          if (error instanceof AxiosError) {
            throw createAdminaError(error.status ?? 500, error.response?.data);
          }
          throw createAdminaError(500, { errorId: "non_axios_error" });
        }
      }
    }
    
    let clientInstance: AdminaApiClient | null = null;
    
    export function getClient(): AdminaApiClient {
      if (!clientInstance) {
        const config = getConfig();
        clientInstance = new AdminaApiClient(config.apiKey, config.organizationId);
      }
    
      return clientInstance;
    }
Behavior2/5

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

No annotations provided; description only states creation and scope. Does not disclose side effects, permission needs, limits, or reversibility. Insufficient for a mutation tool.

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 action and resource. No wasted words.

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?

No output schema so description could specify return value but doesn't. Lacks mention that configuration is only for dropdown. Adequate but incomplete given moderate complexity.

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%, so baseline is 3. Description adds no extra parameter info beyond schema; does not enhance understanding of parameters.

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 action ('Create') and resource ('custom field for organization devices'), and distinguishes from sibling like 'create_identity_custom_field'. No ambiguity.

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?

No explicit guidance on when to use vs. alternatives (e.g., update, delete, identity variant). Implied by name but lacking comparative context.

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