gitea_context_set
Set default context for Gitea operations by configuring owner, repository, organization, or project parameters to streamline subsequent interactions.
Instructions
Set default context for subsequent operations. All parameters are optional.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | No | Default owner (username or organization) | |
| repo | No | Default repository name | |
| org | No | Default organization name | |
| project | No | Default project ID |
Implementation Reference
- src/index.ts:515-537 (handler)Handler function for the 'gitea_context_set' tool. Retrieves the old context, sets the new context using ctx.contextManager.setContext(args), retrieves the new context, and returns a JSON response with old and 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 ), }, ], }; }
- src/index.ts:508-513 (schema)Zod input schema defining optional parameters: owner, repo, org, project for setting the default context.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 using mcpServer.registerTool, including title, description, input schema, 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 ), }, ], }; } );