Skip to main content
Glama

get_accessible_resources

Retrieve accessible Jira resources for a user by email to determine available projects and permissions for issue management.

Instructions

Fetches a list of resources the user has access to.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userEmailYesThe email of the user accessing the resources.

Implementation Reference

  • The main handler function that registers and implements the 'get_accessible_resources' tool. It validates the userEmail input using Zod schema, fetches cached data via getUpdatedCachedData helper, and returns the resources list or an error message if authorization is needed.
    export function getAccessibleResourcesTool(server: McpServer) {
        server.tool('get_accessible_resources',
            'Fetches a list of resources the user has access to.',
            {
                userEmail: z.string().email().describe("The email of the user accessing the resources.")
            },
            async ({ userEmail }) => {
                const cacheData = await getUpdatedCachedData(userEmail);
    
                if(!cacheData) {
                    return {
                        isError: true,
                        content: [
                            {
                                type: "text",
                                text: `Please try again after user confirmed that he authorized the app to access the Jira data.`,
                            },
                        ],
                    };
                }
    
                return {
                    content: [
                        {
                            type: "text",
                            text: JSON.stringify(cacheData.resources),
                        },
                    ],
                }
            });
    }
  • Input schema definition using Zod - validates that userEmail is a valid email address and provides a description for the parameter.
    {
        userEmail: z.string().email().describe("The email of the user accessing the resources.")
    },
  • src/tools/index.ts:4-9 (registration)
    Registration point where getAccessibleResourcesTool is imported and invoked within the registerTools function to register the tool with the MCP server.
    import {getAccessibleResourcesTool} from "./getAccessibleResources.js";
    
    export function registerTools(server: McpServer) {
        createIssueTool(server);
        getProjectsTool(server);
        getAccessibleResourcesTool(server);
  • Helper function getUpdatedCachedData that retrieves cached user data from Redis, handles OAuth token refresh if expired, and returns the CacheData containing resources, or null if authorization is needed.
    export async function getUpdatedCachedData(userEmail: string): Promise<CacheData | null> {
        const cacheStr = await redisClient.get(userEmail);
    
        if(!cacheStr) {
            const authUrl = getAuthorizationUri();
            await open(authUrl);
            return null;
        }
    
        const decompressed =  await decompress(cacheStr);
        const data =  JSON.parse(decompressed) as CacheData;
    
        const decodedToken = jwt.decode(data.accessToken) as JwtPayload;
    
        let accessToken = oauthClient.createToken({
            access_token: data.accessToken,
            expires_at: decodedToken.expires_at || new Date((decodedToken.exp as number) * Constants.MILLISECOND_DIFFERENCE).toISOString(),
            token_type: 'Bearer',
            scope: decodedToken.scope || 'read:jira-user read:jira-work write:jira-work read:me'
        });
    
        if(accessToken.expired()) {
            try {
                accessToken = await accessToken.refresh();
                data.accessToken = accessToken.token.access_token as string;
    
                const expiration = new Date((decodedToken.exp as number) * Constants.MILLISECOND_DIFFERENCE + Constants.DAY_IN_MS).getTime() - Date.now();
                const compressedData = await compress(JSON.stringify(data));
                await redisClient.setex(userEmail, expiration, compressedData);
    
                return data;
            } catch (error) {
                logger.error('Error refreshing access token:', error);
                const authUrl = getAuthorizationUri();
                await open(authUrl);
                return null;
            }
        }
    
        return data;
    
    }
  • Type definition for CacheData which includes accessToken, userInfo (accountId, email, displayName), and resources (id, url) - this defines the structure of the data returned by the tool.
    export type CacheData = {
        accessToken: string;
        userInfo: {
            accountId: string;
            email: string;
            displayName: string;
        },
        resources: {
            id: string;
            url: string;
        }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool fetches a list but doesn't describe what 'resources' entail, whether it's read-only, if there are rate limits, or what the output format is. This leaves significant gaps for a tool that accesses user data.

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 that directly states the tool's function without unnecessary words. It's front-loaded and wastes no space, making it easy for an agent 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 lack of annotations and output schema, the description is incomplete. It doesn't explain what 'resources' are, the return format, or any behavioral traits like permissions or limitations, which are crucial for a tool that accesses user-specific data.

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?

The schema description coverage is 100%, so the parameter 'userEmail' is fully documented in the schema. The description doesn't add any meaning beyond what the schema provides, such as explaining why this parameter is needed or how it affects the results, which aligns with the baseline score for high schema coverage.

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 action ('fetches') and resource ('list of resources the user has access to'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'get_projects' which might also retrieve resources, so it doesn't reach the highest 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?

No guidance is provided on when to use this tool versus alternatives like 'get_projects' or 'create_issue'. The description lacks context on prerequisites or exclusions, leaving the agent to infer usage based on 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

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/razvancanuci/jira-issue-mcp-server'

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