Skip to main content
Glama
Infisical

Infisical MCP Server

Official
by Infisical

get-secret

Retrieve a specific secret from a designated project and environment in Infisical. Specify the secret name, project ID, and environment slug to securely access stored secrets and manage configurations.

Instructions

Get a secret in Infisical

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
environmentSlugYesThe slug of the environment to get the secret from (required)
expandSecretReferencesNoWhether to expand secret references (Defaults to true)
includeImportsNoWhether to include secret imports. If the secret isn't found, it will try to find a secret in a secret import that matches the requested secret name (Defaults to true)
projectIdYesThe ID of the project to get the secret from (required)
secretNameYesThe name of the secret to get (required)
secretPathNoThe path of the secret to get (Defaults to /)

Implementation Reference

  • The handler logic for the 'get-secret' tool within the CallToolRequestSchema request handler. It validates the input arguments using the Zod schema, calls the Infisical SDK's getSecret method with the parsed parameters, and returns the retrieved secret in a formatted text response.
    if (name === AvailableTools.GetSecret) {
    	const data = getSecretSchema.zod.parse(args);
    
    	const secret = await infisicalSdk.secrets().getSecret({
    		environment: data.environmentSlug,
    		projectId: data.projectId,
    		secretName: data.secretName,
    		secretPath: data.secretPath,
    		expandSecretReferences: data.expandSecretReferences,
    		includeImports: data.includeImports
    	});
    
    	return {
    		content: [
    			{
    				type: "text",
    				text: `Secret retrieved successfully: ${JSON.stringify(secret, null, 3)}`
    			}
    		]
    	};
    }
  • The schema definition for the 'get-secret' tool, including Zod validation object and the MCP inputSchema capability for tool discovery and validation.
    const getSecretSchema = {
    	zod: z.object({
    		secretName: z.string(),
    		projectId: z.string(),
    		environmentSlug: z.string(),
    		secretPath: z.string().default("/"),
    		expandSecretReferences: z.boolean().default(true),
    		includeImports: z.boolean().default(true)
    	}),
    	capability: {
    		name: AvailableTools.GetSecret,
    		description: "Get a secret in Infisical",
    		inputSchema: {
    			type: "object",
    			properties: {
    				secretName: {
    					type: "string",
    					description: "The name of the secret to get (required)"
    				},
    				projectId: {
    					type: "string",
    					description: "The ID of the project to get the secret from (required)"
    				},
    				environmentSlug: {
    					type: "string",
    					description: "The slug of the environment to get the secret from (required)"
    				},
    				secretPath: {
    					type: "string",
    					description: "The path of the secret to get (Defaults to /)"
    				},
    				expandSecretReferences: {
    					type: "boolean",
    					description: "Whether to expand secret references (Defaults to true)"
    				},
    				includeImports: {
    					type: "boolean",
    					description:
    						"Whether to include secret imports. If the secret isn't found, it will try to find a secret in a secret import that matches the requested secret name (Defaults to true)"
    				}
    			},
    			required: ["projectId", "environmentSlug", "secretName"]
    		}
    	}
    };
  • src/index.ts:452-467 (registration)
    The tool registration in the ListToolsRequestSchema handler, where getSecretSchema.capability is included in the list of available tools returned to clients.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
    	return {
    		tools: [
    			createSecretSchema.capability,
    			deleteSecretSchema.capability,
    			updateSecretSchema.capability,
    			listSecretsSchema.capability,
    			getSecretSchema.capability,
    			createProjectSchema.capability,
    			createEnvironmentSchema.capability,
    			createFolderSchema.capability,
    			inviteMembersToProjectSchema.capability,
    			listProjectsSchema.capability
    		]
    	};
    });
  • src/index.ts:57-68 (registration)
    Enum defining the tool names, including 'get-secret' as AvailableTools.GetSecret, used throughout for matching tool calls.
    enum AvailableTools {
    	CreateSecret = "create-secret",
    	DeleteSecret = "delete-secret",
    	UpdateSecret = "update-secret",
    	ListSecrets = "list-secrets",
    	GetSecret = "get-secret",
    	CreateProject = "create-project",
    	CreateEnvironment = "create-environment",
    	CreateFolder = "create-folder",
    	InviteMembersToProject = "invite-members-to-project",
    	ListProjects = "list-projects"
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the basic action without disclosing behavioral traits. It doesn't mention authentication needs, rate limits, error handling, or what happens if the secret isn't found, which is critical for a secret retrieval 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?

The description is a single, efficient sentence with zero waste—it directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a secret retrieval tool with 6 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain return values, error conditions, or security implications, leaving significant gaps for the agent to operate safely and effectively.

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 the schema fully documents all 6 parameters. The description adds no additional meaning beyond what's in the schema, such as explaining relationships between parameters or typical use cases, resulting in the baseline score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('a secret in Infisical'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'list-secrets' or 'create-secret' beyond the basic action, which prevents a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'list-secrets' for multiple secrets or 'create-secret' for new ones. It lacks context about prerequisites or typical scenarios, leaving the agent to infer usage from the tool name alone.

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

Related 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/Infisical/infisical-mcp-server'

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