Skip to main content
Glama

gitea_context_set

Set default Gitea context for repository operations by configuring owner, repo, organization, or project parameters to streamline subsequent commands.

Instructions

Set default context for subsequent operations. All parameters are optional.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerNoDefault owner (username or organization)
repoNoDefault repository name
orgNoDefault organization name
projectNoDefault project ID

Implementation Reference

  • Handler function for gitea_context_set: Gets old context, calls setContext on contextManager with args, gets new context, returns JSON with old/new contexts.
    async (args) => { const oldContext = ctx.contextManager.getContext(); ctx.contextManager.setContext(args); const newContext = ctx.contextManager.getContext(); return { content: [ { type: 'text' as const, text: JSON.stringify( { success: true, message: 'Context updated successfully', oldContext, newContext, }, null, 2 ), }, ], }; }
  • Input schema using Zod for optional parameters: owner, repo, org, project.
    inputSchema: z.object({ owner: z.string().optional().describe('Default owner (username or organization)'), repo: z.string().optional().describe('Default repository name'), org: z.string().optional().describe('Default organization name'), project: z.number().optional().describe('Default project ID'), }),
  • src/index.ts:503-538 (registration)
    Registration of the gitea_context_set tool with title, description, inputSchema, and inline handler function.
    mcpServer.registerTool( 'gitea_context_set', { title: '设置默认上下文', description: 'Set default context for subsequent operations. All parameters are optional.', inputSchema: z.object({ owner: z.string().optional().describe('Default owner (username or organization)'), repo: z.string().optional().describe('Default repository name'), org: z.string().optional().describe('Default organization name'), project: z.number().optional().describe('Default project ID'), }), }, async (args) => { const oldContext = ctx.contextManager.getContext(); ctx.contextManager.setContext(args); const newContext = ctx.contextManager.getContext(); return { content: [ { type: 'text' as const, text: JSON.stringify( { success: true, message: 'Context updated successfully', oldContext, newContext, }, null, 2 ), }, ], }; } );
  • ContextManager.setContext: Updates internal context fields conditionally if provided in partial context.
    setContext(context: Partial<GiteaContext>): void { if (context.owner !== undefined) { this.context.owner = context.owner; logger.debug({ owner: context.owner }, 'Owner context updated'); } if (context.repo !== undefined) { this.context.repo = context.repo; logger.debug({ repo: context.repo }, 'Repo context updated'); } if (context.org !== undefined) { this.context.org = context.org; logger.debug({ org: context.org }, 'Org context updated'); } if (context.project !== undefined) { this.context.project = context.project; logger.debug({ project: context.project }, 'Project context updated'); }

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/SupenBysz/gitea-mcp-tool'

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