Set Runtime Configuration Value
procore_set_configSet runtime configuration keys (company_id or project_id) to switch default company/project context without restarting the server. Changes persist until server restart.
Instructions
Set a runtime configuration key (e.g. company_id or project_id) for the current session. The change persists until the server restarts. Use this to switch the default company/project context without restarting the MCP server. Returns a confirmation message.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Config key — currently 'company_id' or 'project_id' | |
| value | Yes | New value (string; numbers are coerced server-side) |
Implementation Reference
- src/tools/registry.ts:211-239 (registration)Registration of the 'procore_set_config' tool with the MCP server, including its title, description, input schema (key and value), and the async handler that calls handleSetConfig.
// 7. Set Config server.registerTool( "procore_set_config", { title: "Set Runtime Configuration Value", description: "Set a runtime configuration key (e.g. company_id or project_id) for the " + "current session. The change persists until the server restarts. Use this " + "to switch the default company/project context without restarting the MCP " + "server. Returns a confirmation message.", inputSchema: { key: z .string() .describe("Config key — currently 'company_id' or 'project_id'"), value: z.string().describe("New value (string; numbers are coerced server-side)"), }, annotations: { title: "Set Config", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false, }, }, async (args) => { const text = await handleSetConfig(args); return { content: [{ type: "text" as const, text }] }; } ); - src/tools/handlers/set-config.ts:1-26 (handler)The handleSetConfig function that validates the key (allowed: company_id, project_id), coerces numeric values via parseInt, calls setRuntimeConfig, and returns a confirmation message with the current config state.
import { setRuntimeConfig, getRuntimeConfig } from "../../api/client.js"; export async function handleSetConfig(args: { key: string; value: string; }): Promise<string> { const allowedKeys = ["company_id", "project_id"]; if (!allowedKeys.includes(args.key)) { return `Invalid config key: "${args.key}". Allowed keys: ${allowedKeys.join(", ")}`; } const numericKeys = ["company_id", "project_id"]; const value = numericKeys.includes(args.key) ? parseInt(args.value, 10) : args.value; if (numericKeys.includes(args.key) && isNaN(value as number)) { return `"${args.key}" must be a number. Got: "${args.value}"`; } setRuntimeConfig(args.key, value); const config = getRuntimeConfig(); return `Config updated: ${args.key} = ${value}\n\nCurrent config: ${JSON.stringify(config, null, 2)}`; } - src/api/client.ts:211-223 (helper)Runtime config store (in-memory) with setRuntimeConfig and getRuntimeConfig helper functions that read/write key-value pairs to the runtimeConfig object.
// Runtime config store (in-memory, set via procore_set_config tool) let runtimeConfig: Record<string, string | number> = {}; export function getRuntimeConfig(): Record<string, string | number> { return { ...runtimeConfig }; } export function setRuntimeConfig( key: string, value: string | number ): void { runtimeConfig[key] = value; } - src/tools/registry.ts:221-226 (schema)Input schema for the tool defining 'key' (string, described as 'company_id' or 'project_id') and 'value' (string, coerced server-side) using Zod validation.
inputSchema: { key: z .string() .describe("Config key — currently 'company_id' or 'project_id'"), value: z.string().describe("New value (string; numbers are coerced server-side)"), },