:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(skills): accept the manifest key `path` on skill-file-get (#101741)
posthog[bot]c9461d49f831
diff --git a/products/skills/mcp/tools.yaml b/products/skills/mcp/tools.yamlindex 6180d9850c32..44f6cfc75015 100644--- a/products/skills/mcp/tools.yaml+++ b/products/skills/mcp/tools.yaml@@ -127,6 +127,13 @@ tools:Remove a bundled file from an agent skill by path. Fails with 404 if the file is not in the latest version.Publishes a new skill version and returns 200 with the updated skill body (not 204) — read its 'version'field to chain further edits via base_version. Supply base_version for optimistic concurrency.+ param_overrides:+ file_path:+ description: >+ The file's path, copied from the `path` field of a skill-get manifest entry (e.g.+ `references/limits.md`). Sending it as `path` also works.+ aliases:+ - pathskill-file-get:operation: llm_skills_name_files_retrieveenabled: true@@ -141,6 +148,13 @@ tools:Fetch a single bundled file from an agent skill by its path. Use the file manifest from skill-get todiscover available files. Supports progressive disclosure — only load files when needed rather than fetchingall content upfront.+ param_overrides:+ file_path:+ description: >+ The file's path, copied from the `path` field of a skill-get manifest entry (e.g.+ `references/limits.md`). Sending it as `path` also works.+ aliases:+ - pathskill-file-rename:operation: llm_skills_name_files_rename_createenabled: truediff --git a/products/skills/skills/skills-store/SKILL.md b/products/skills/skills/skills-store/SKILL.mdindex 2fbaf4ae9f19..4c399eb73556 100644--- a/products/skills/skills/skills-store/SKILL.md+++ b/products/skills/skills/skills-store/SKILL.md@@ -188,11 +188,11 @@ Non-targeted files carry forward unchanged. `file_edits` cannot add, remove, orThe file-path parameter has two names depending on where it sits in the request, so don't guess:-- **`file_path`** — `skill-file-get` and `skill-file-delete` (the path is part of the URL).+- **`file_path`** — `skill-file-get` and `skill-file-delete` (the path is part of the URL). Both also accept `path`, so a manifest entry copied straight across works.- **`path`** — `skill-file-create`, plus the `files=[{path, …}]` array and `file_edits=[{path, …}]` (body fields on a file object).- **`old_path` / `new_path`** — `skill-file-rename`.-Passing `path` to file-get produces a `/files/undefined/` 404. When in doubt, check the tool's input schema.+When in doubt, check the tool's input schema.### Adding, removing, or renaming a filediff --git a/products/skills/skills/working-with-skills/SKILL.md b/products/skills/skills/working-with-skills/SKILL.mdindex 898eeddc0d41..8c80efc546aa 100644--- a/products/skills/skills/working-with-skills/SKILL.md+++ b/products/skills/skills/working-with-skills/SKILL.md@@ -249,7 +249,8 @@ The same concept — a bundled file's path — is named differently depending onmemory. There is one rule:- **`file_path`** — when the path is part of the **URL** (`skill-file-get`,- `skill-file-delete`). These read/delete one file addressed by its path.+ `skill-file-delete`). These read/delete one file addressed by its path. Both+ also accept `path` and normalize it to `file_path`, so the manifest key works.- **`path`** — when the path is a **body field**: `skill-file-create`, the`files=[{path, content, content_type}]` array, and `file_edits=[{path, edits}]`.- **`old_path` / `new_path`** — body fields on `skill-file-rename`.@@ -257,8 +258,7 @@ memory. There is one rule:Mnemonic: `path` is the field name on a file _object_ (it sits next to`content`), so everything that carries a file object uses `path`; the twotools that address a file by URL use `file_path`. When unsure, check the-tool's input schema rather than guessing — passing `path` to file-get yields a-`/files/undefined/` 404.+tool's input schema rather than guessing.### Adding, removing, renaming filesdiff --git a/services/mcp/src/tools/generated/skills.ts b/services/mcp/src/tools/generated/skills.tsindex cf5113e0b220..15d1572ae466 100644--- a/services/mcp/src/tools/generated/skills.ts+++ b/services/mcp/src/tools/generated/skills.ts@@ -3,6 +3,7 @@ import { z } from 'zod'import type { Schemas } from '@/api/generated'import * as orvalSchemas from '@/generated/skills/api'+import { normalizeParamAliases } from '@/tools/cast-helpers'import type { Context, ToolBase, ZodObjectAny } from '@/tools/types'const SkillArchiveSchema = () => {@@ -134,7 +135,16 @@ const skillFileCreate = (): ToolBase<ReturnType<typeof SkillFileCreateSchema>, Sconst SkillFileDeleteSchema = () => {const LlmSkillsNameFilesDestroyParams = orvalSchemas.LlmSkillsNameFilesDestroyParams()const LlmSkillsNameFilesDestroyQueryParams = orvalSchemas.LlmSkillsNameFilesDestroyQueryParams()- return LlmSkillsNameFilesDestroyParams.omit({ project_id: true }).extend(LlmSkillsNameFilesDestroyQueryParams.shape)+ return z.preprocess(+ normalizeParamAliases({ file_path: ['path'] }),+ LlmSkillsNameFilesDestroyParams.omit({ project_id: true })+ .extend(LlmSkillsNameFilesDestroyQueryParams.shape)+ .extend({+ file_path: LlmSkillsNameFilesDestroyParams.shape['file_path'].describe(+ "The file's path, copied from the `path` field of a skill-get manifest entry (e.g. `references/limits.md`). Sending it as `path` also works."+ ),+ })+ )}const skillFileDelete = (): ToolBase<ReturnType<typeof SkillFileDeleteSchema>, Schemas.LLMSkill> => ({@@ -156,8 +166,15 @@ const skillFileDelete = (): ToolBase<ReturnType<typeof SkillFileDeleteSchema>, Sconst SkillFileGetSchema = () => {const LlmSkillsNameFilesRetrieveParams = orvalSchemas.LlmSkillsNameFilesRetrieveParams()const LlmSkillsNameFilesRetrieveQueryParams = orvalSchemas.LlmSkillsNameFilesRetrieveQueryParams()- return LlmSkillsNameFilesRetrieveParams.omit({ project_id: true }).extend(- LlmSkillsNameFilesRetrieveQueryParams.shape+ return z.preprocess(+ normalizeParamAliases({ file_path: ['path'] }),+ LlmSkillsNameFilesRetrieveParams.omit({ project_id: true })+ .extend(LlmSkillsNameFilesRetrieveQueryParams.shape)+ .extend({+ file_path: LlmSkillsNameFilesRetrieveParams.shape['file_path'].describe(+ "The file's path, copied from the `path` field of a skill-get manifest entry (e.g. `references/limits.md`). Sending it as `path` also works."+ ),+ }))}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-skill-file-delete.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-skill-file-delete.jsonindex 262304f0c4ce..4fdcc978e0ad 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-skill-file-delete.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-skill-file-delete.json@@ -7,6 +7,7 @@"type": "number"},"file_path": {+ "description": "The file's path, copied from the `path` field of a skill-get manifest entry (e.g. `references/limits.md`). Sending it as `path` also works.","pattern": "^.+$","type": "string"},diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-skill-file-get.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-skill-file-get.jsonindex 7cded468fe20..e1f502fc9b4e 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-skill-file-get.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-skill-file-get.json@@ -2,6 +2,7 @@"$schema": "https://json-schema.org/draft/2020-12/schema","properties": {"file_path": {+ "description": "The file's path, copied from the `path` field of a skill-get manifest entry (e.g. `references/limits.md`). Sending it as `path` also works.","pattern": "^.+$","type": "string"},diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/skill-file-delete.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/skill-file-delete.jsonindex 262304f0c4ce..4fdcc978e0ad 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/skill-file-delete.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/skill-file-delete.json@@ -7,6 +7,7 @@"type": "number"},"file_path": {+ "description": "The file's path, copied from the `path` field of a skill-get manifest entry (e.g. `references/limits.md`). Sending it as `path` also works.","pattern": "^.+$","type": "string"},diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/skill-file-get.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/skill-file-get.jsonindex 7cded468fe20..e1f502fc9b4e 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/skill-file-get.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/skill-file-get.json@@ -2,6 +2,7 @@"$schema": "https://json-schema.org/draft/2020-12/schema","properties": {"file_path": {+ "description": "The file's path, copied from the `path` field of a skill-get manifest entry (e.g. `references/limits.md`). Sending it as `path` also works.","pattern": "^.+$","type": "string"},diff --git a/services/mcp/tests/unit/skills-generated.test.ts b/services/mcp/tests/unit/skills-generated.test.tsindex d81245a3ef25..73006e9cf7d6 100644--- a/services/mcp/tests/unit/skills-generated.test.ts+++ b/services/mcp/tests/unit/skills-generated.test.ts@@ -42,6 +42,47 @@ describe('Generated skill-* tools', () => {expect(result).toBeUndefined()})+ // The file manifest from `skill-get` names a bundled file's path `path`, but the two tools that+ // address a file by URL take `file_path`. Production traces show agents carrying the manifest key+ // over and being rejected at the schema, so both tools accept `path` and normalize it.+ describe.each([['skill-file-get'], ['skill-file-delete']])('%s accepts `path` for file_path', (toolName) => {+ const schema = getToolByName(GENERATED_TOOLS, toolName).schema++ it('normalizes path to file_path', () => {+ const parsed = schema.parse({ skill_name: 'skills-store', path: 'references/limits.md' }) as Record<+ string,+ unknown+ >++ expect(parsed.file_path).toBe('references/limits.md')+ expect(parsed).not.toHaveProperty('path')+ })++ it('keeps file_path when the caller sends both keys', () => {+ const parsed = schema.parse({+ skill_name: 'skills-store',+ file_path: 'references/limits.md',+ path: 'other.md',+ }) as Record<string, unknown>++ expect(parsed.file_path).toBe('references/limits.md')+ })+ })++ it('sends the aliased path in the skill-file-get URL', async () => {+ const { context, requestMock } = createContext({ path: 'references/limits.md' })+ const tool = getToolByName(GENERATED_TOOLS, 'skill-file-get')++ await tool.handler(context, tool.schema.parse({ skill_name: 'skills-store', path: 'references/limits.md' }))++ expect(requestMock).toHaveBeenCalledWith(+ expect.objectContaining({+ method: 'GET',+ path: '/api/projects/17/llm_skills/name/skills-store/files/references%2Flimits.md/',+ })+ )+ })+it('deprecated llma-skill-* alias forwards to the renamed handler and annotates the response', async () => {const { context, requestMock } = createContext({ name: 'skills-store' })const alias = SKILL_DEPRECATED_ALIASES['llma-skill-get']!()