create_access_token
Generate a new access token for a client using specified parameters like provider ID, client ID, and expiration time. Essential for authenticating and managing access on the UseGrant MCP Server.
Instructions
Create a new access token for a client
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| audienceAsArray | No | Whether to use an array of audiences | |
| clientId | Yes | The ID of the client | |
| expiresIn | No | The number of seconds the token will be valid for | |
| forceDefaultDomain | No | Whether to force the default domain | |
| providerId | Yes | The ID of the provider | |
| useJwtType | No | Whether to use at+jwt token type in the header |
Implementation Reference
- src/index.ts:205-210 (handler)MCP tool handler: destructures providerId, clientId, payload; calls usegrant.createToken; returns JSON-formatted token as text content.async ({ providerId, clientId, ...payload }) => { const token = await usegrant.createToken(providerId, clientId, payload); return { content: [{ type: 'text', text: JSON.stringify(token, null, 2) }], }; },
- src/index.ts:200-204 (schema)Input schema for the tool, combining ProviderIdSchema, ClientIdSchema, and CreateTokenSchema.shape from UgSchema.{ providerId: UgSchema.ProviderIdSchema, clientId: UgSchema.ClientIdSchema, ...UgSchema.CreateTokenSchema.shape, },
- src/index.ts:197-211 (registration)Registration of the create_access_token tool on the MCP server with name, description, input schema, and handler function.server.tool( 'create_access_token', 'Create a new access token for a client', { providerId: UgSchema.ProviderIdSchema, clientId: UgSchema.ClientIdSchema, ...UgSchema.CreateTokenSchema.shape, }, async ({ providerId, clientId, ...payload }) => { const token = await usegrant.createToken(providerId, clientId, payload); return { content: [{ type: 'text', text: JSON.stringify(token, null, 2) }], }; }, );