ninja_get_organization_custom_fields
Retrieve custom field values for an organization, with the option to include inherited values.
Instructions
Get custom field values for an organization.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Organization ID | |
| withInheritance | No | Include inherited custom field values |
Implementation Reference
- src/tools/organizations.ts:170-171 (handler)Handler function for ninja_get_organization_custom_fields. It destructures 'id' from args and passes remaining params (e.g., withInheritance) as query parameters to GET /organization/{id}/custom-fields with undefined/empty values cleaned out.
handler: async ({ id, ...params }, client: NinjaOneClient) => client.get(`/organization/${id}/custom-fields`, clean(params)), - src/tools/organizations.ts:155-168 (schema)Input schema for ninja_get_organization_custom_fields. Requires 'id' (number) and optionally accepts 'withInheritance' (boolean). Defined as part of the Tool object within the ToolDef array entry.
tool: { name: 'ninja_get_organization_custom_fields', description: 'Get custom field values for an organization.', inputSchema: { type: 'object', required: ['id'], properties: { id: { type: 'number', description: 'Organization ID' }, withInheritance: { type: 'boolean', description: 'Include inherited custom field values', }, }, }, - src/tools/organizations.ts:154-171 (registration)Registration entry in the organizationTools array. The tool object contains name 'ninja_get_organization_custom_fields', description, and inputSchema. Its handler is registered alongside.
{ tool: { name: 'ninja_get_organization_custom_fields', description: 'Get custom field values for an organization.', inputSchema: { type: 'object', required: ['id'], properties: { id: { type: 'number', description: 'Organization ID' }, withInheritance: { type: 'boolean', description: 'Include inherited custom field values', }, }, }, }, handler: async ({ id, ...params }, client: NinjaOneClient) => client.get(`/organization/${id}/custom-fields`, clean(params)), - src/tools/index.ts:13-24 (registration)ALL_TOOLS array spreads organizationTools (which includes ninja_get_organization_custom_fields) into the combined tool list for registration with the MCP server.
export const ALL_TOOLS = [ ...deviceTools, ...organizationTools, ...alertTools, ...activityTools, ...ticketingTools, ...queryTools, ...policyTools, ...userTools, ...backupTools, ...systemTools, ]; - src/index.ts:24-37 (registration)toolMap created from ALL_TOOLS mapping tool names to handlers. The CallToolRequestSchema handler looks up the handler by name (e.g., 'ninja_get_organization_custom_fields') and invokes it.
const toolMap = new Map(ALL_TOOLS.map((def) => [def.tool.name, def.handler])); const server = new Server( { name: 'ninjaone-mcp', version: '1.0.0' }, { capabilities: { tools: {} } }, ); server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: ALL_TOOLS.map((def) => def.tool), })); server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; const handler = toolMap.get(name);